Die Anzahl von Post Attachments (Medien) in einem WordPress Artikel oder einer Seite lässt sich mit folgendem Code ermitteln:
<?php $attachments = get_children(array('post_parent'=>$post->ID)); $nbImg = count($attachments); echo 'There are '.$nbImg.' pictures on this post.';
Quelle: http://wordpress.org/support/topic/post-attachment-count