Forums

Anyone know how to exclude the latest post from a query? (3 posts)

  1. Zac
    Member
    Posted 1 year ago #

    I have a query to return the latest post titles from a category.

    <?php $the_query = new WP_Query('category_name=events&showposts=5'); ?>
    ?php while ($the_query->have_posts()) : $the_query->the_post();?><a href="<?php the_permalink() ?>" rel="bookmark" class="postTitleLink">
    <?php the_title(); ?></a>
    <?php endwhile; ?><?php rewind_posts(); ?>

    Is it possible to give it the property to exclude the most recent or current post?

  2. MAS
    Member
    Posted 1 year ago #

    use thisnew WP_Query('category_name=events&showposts=5&offset=1');

  3. Zac
    Member
    Posted 1 year ago #

    Cool! Thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic