• Hi,
    I’m new to wordpress, got it installed and now customizing.
    I’d like to show in my sidebar the ten latest (chronologically) posts. I’m sure it’s a simple script that I can include in the sidebar.php
    Any help?

    Thanks!
    https://www.fordmuscle.com/blog/

Viewing 2 replies - 1 through 2 (of 2 total)
  • There are plugins to accomplish this or you can use code <h2><?php _e('Recent Posts'); ?></h2>
    <ul>
    <?php
    $posts = get_posts('numberposts=10');
    foreach($posts as $post) :
    setup_postdata($post);
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

    The difference being, a plugin, all you have to do is change the function call for the plugin in your sidebar if you change themes, the code you’d have to copy and paste the whole section.

    Thread Starter 67stang

    (@67stang)

    got it thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help a novice…. How can I list the 10 latest posts?’ is closed to new replies.