• Anyone have an idea of how to exclude the most recent post from the archives?

    My client wants a page with the most recent post on the top, then an archive list lower down. I can do that, no problem, but the archive list shows the most recent post — meaning that post is listed twice on the same page.

    How can I set up the archives so that the most recent post doesn’t show up?

    Many thanks — I’m on a deadline, so if anyone has any idea, don’t hesitate! ??

    Thanks again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I think the get_post tag has an offset parameter, perhaps that would be a starting point?

    Thread Starter mwselz

    (@mwselz)

    Looks like get_post returns values for a specific post… not sure (having very little php-fu) how I would turn that around to exclude the most recent post.

    Thanks — keep ’em coming!

    Not from a specific post, it’s more like a mini loop

    Template_Tags/get_posts

    Thread Starter mwselz

    (@mwselz)

    Hey, that’s working *nearly* perfectly! The only thing is, it only shows the date on the first archive entry. Here’s the code:


    <ul>
    <?php
    $myposts = get_posts('numberposts=12&offset=1&orderby=post_date&order=DESC&category=2');
    foreach($myposts as $post) :
    ?>

    <li><strong><a>"><?php the_title(); ?></a></strong>
    <?php the_date(); echo ""; ?>
    <?php the_excerpt(); ?>
    <?php endforeach; ?></li>
    </ul>

    the_date() is intended to display once per each day’s worth of posts. So if you have 10 posts on a page and they were all published on the same day, the_date() would output only once.

    Instead, try out this little trick:

    <?php the_time(get_settings('date_format')); >

    Thread Starter mwselz

    (@mwselz)

    That’s got it! Thanks very much; everyone’s been brilliant.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Exclude Most Recent Post From Archives’ is closed to new replies.