Recent post thumbnail image sidebar (4 posts)

  1. Jajton
    Posted 3 years ago #

    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

  2. Can you use something like:

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

  3. Jajton
    Posted 3 years ago #

    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.. :(

  4. Jajton
    Posted 3 years ago #

    how can i resolve this problem?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.