• Hi,

    I’m trying to display the 5 most recent posts in single.php using this:

    <ul>
    <?php
    $latest = get_posts('numberposts=5');
    foreach( $latest as $post ):
    ?>
    <li><?php the_time(get_option('date_format')); ?> | <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach ?>
    </ul>

    Is it ok to use this code in single.php to display multiple posts?

    Also, if it’s ok, is it possible to hide the current post from showing up in the list over the most recent posts??

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display 5 recent posts in single.php?’ is closed to new replies.