• Here is the link to the page I am referring to:

    http://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)
  • Thread Starter bigskydj07

    (@bigskydj07)

    Update…

    SO, I have changed the code a bit and it appears that the real problem is that the code is only returning a thumbnail(s) uploaded/inserted directly through the wordpress editor. The problem is, I am using nextgen gallery, direct upload, linking images, etc..basically, I want to be free to upload images however I want.

    How can I get it to display the first thumbnail from each post regardless of how the image is uploaded/linked? Does this make sense?

    Thanks in advance for any help!

    Did you achieve, what you were trying to do yourself? I would be very interested in your solution (how you changed the code), as I am trying to achieve the same in my archive view.

    Thanks in advance!

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.