• Hi, On my home page I would like to display the most recent post in full and then have a list of the 5 posts prior to that.

    Matt Brett Has done something similar to what I’d like with his Previous Entries section.

    I want to eventually achieve something that slick but for the time being a list of post titles and dates will be fine.

    How do I do this?

    Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You want to look at using template tag, query_posts(). Make sure you look at the Resource section, in that article also.

    To get the ‘5 prior posts’ use the offset parameter.

    Thread Starter minute44

    (@minute44)

    yeah.. ok.

    Has anyone done this so I can look at what you’ve done? Reading pages and pages of instructions tends not to teach me anything. I need an exaple to pull apart and break so I can learn it that way.

    Anyone.

    Did you look at several of the links on the Resource section of that article?

    To anyone who views this. Hope this helps.

    1] This will go on your index.php in your theme folder, most likely anyways.

    The php before you start the WP loop:
    <?php query_posts("cat=1&year=$current_year&monthnum=$current_month&order=DESC&showposts=10"); ?>

    Change the values as you please. This will display the 10 most recent post in category 1 for the current month & year in descending order. So most recent will be at the top.

    2] Then you need to throw in the WP loop:
    <?php while (have_posts()) : the_post(); ?>

    3] Then you need to tell WP how to display the information:
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>

    This will list all 10 most recent posts each with a permalink to their respective posts.

    4] Close the loop:
    <?php endwhile; ?>

    Thats it. Hope that helps anyone ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘5 previous posts’ is closed to new replies.