• Resolved vikkineal

    (@vikkineal)


    Hi

    I want to be able to show a panel of 3 most recent post, including the thumbnail (featured) image if it has one. I don’t want to use the sidebar.php file – but in essence am creating another version of it – it is to go on specific pages of the site.

    My sidebar code is as follows and just shows the latest list of posts in a UL.

    <ul>
        <?php
    $IDOutsideLoop = $post->ID;
    global $post;
    
    $myposts = get_posts('showposts=10');
    foreach($myposts as $post) :
    ?>
        <li <?php if(is_single() && $IDOutsideLoop == $post->ID) print 'class="currentPost"' ?>><a href="<?php the_permalink(); ?>">
          <?php the_title(); ?>
          </a></li>
        <?php endforeach; ?>
      </ul>

    For my new version, I ideally want the HTML to work in something like this

    <ul>
    <li><a href="#"><img src="http://localhost:8888/wp-content/themes/sandbanks/images/feature-panels/news/placeholder.jpg" width="260" height="91" alt="" /></a><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend, massa et sollicitudin rutrum, neque felis varius quam, quis eleifend augue <a href="#">READ MORE</a></p></li>
    </ul>

    But am rather stuck at where to start. Any pointers would be greatly appreciated 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding post images (thumbnails) to sidebar’ is closed to new replies.