Same thumbnail repeating for archives- but links correct!?! Help
-
Here is the link to the page I am referring to:
https://mcnairevansblog.com/archives
Although the same image repeats, the links are directing to the correct post. How would I display the first image from each corresponding post? My (archives.php)
code is as follows:<div class="entrycat"> <br /> <!-- archives with the_excerpt so the page shows a grid of thumbnails for each post--> <?php $arc_query = new WP_Query('orderby=post_date&order=DESC&showposts=-1'); ?> <?php while ($arc_query->have_posts()) : $arc_query->the_post(); ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo get_first_image('WIDTH=75&HEIGHT=75'); ?></a> <!--<?php the_title(''); ?>--> <?php endwhile; ?> </div>
and my (functions.php) code is here:
function get_first_image($post_ID, $fullsize=false, $max_dims=false){ $thumbargs = array( 'post_type' => 'attachment', 'post_status' => null, 'post_parent' => $post_ID ); $thumbs = get_posts($thumbargs); if ($thumbs) { $num = count($thumbs)-1; return get_attachment_innerHTML($thumbs[$num]->ID, $fullsize, $max_dims); } }
Thanks in advance for any help or advice!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Same thumbnail repeating for archives- but links correct!?! Help’ is closed to new replies.