• I’m really new to this all, but have experience in website designing, but just learning how to edit php.

    I’ve noticed on other blogs that there is a section on the sidebar that lists “x” amount of previous posts. That way visitors can see the titles of your last 10 or so posts, click on one, and read it.

    How do you add this feature?

    Thanks!

    Rachel

Viewing 2 replies - 1 through 2 (of 2 total)
  • Generally speaking, this is how I achieve recent posts.


    <h2>Recent Posts</h2>
    <ul>
    <?php
    $posts = get_posts('numberposts=5');
    foreach($posts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

    Where as numberposts is obviously the number you want. You can also add the_content, or the_excerpt if you’d like.
    Conversely, I’m sure there are a few plugins that achieve this, I just haven’t used them.

    Thread Starter racheld

    (@racheld)

    Thank you! I’ll give that a try and also look into some plugins!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to list previous posts on side bar?’ is closed to new replies.