Showing post thumbnail (attachment) on the archive.php category listing
You could use the WordPress function get_children. Although I don’t think it makes a difference, performance-wise. <?php while (have_posts()) : the_post(); ?> <?php $attachment = array_values( get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘numberposts’ => 1 ) ) ); ?> <div class=”searchItem” style=”clear:both;”> <h3 id=”post-<?php the_ID(); ?>”> <?php … Read more