Support » Fixing WordPress » Recent post thumbnail image sidebar

  • hi everyone, im newbie here with wp and php.. I already have the “Recent Posts” section to the sidebar that includes thumbnails with image.. my problem is this, i want the image and the post title to be clickable where the post is located… this is my current code

    <?php foreach ( (array) get_posts(‘numberposts=2’) as $_post ) : ?>
    <div><?php echo $_post->post_title; ?></div>
    <div id=”imageThumb”><?php echo get_the_post_thumbnail ($_post->ID); ?> </div>
    <?php endforeach; ?>

    pls help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Christine Rondeau


    Volunteer Forum Moderator

    Can you use something like:

    <div id="imageThumb"><a href="<?php the_permalink();?>"><?php echo get_the_post_thumbnail ($_post->ID); ?></a> </div>

    hi Christine.. I already did, it works bt the other recent post link to same post which is the latest post.. it has also same url above.. 🙁

    how can i resolve this problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Recent post thumbnail image sidebar’ is closed to new replies.