WordPress.org

Support

Support » Themes and Templates » [Resolved] How to exclude most recent post

[Resolved] How to exclude most recent post

  • I want to show posts on my homepage the regular way but wanna exclude the most recent post. Can you please tell which tag I have to include in my template.

Viewing 4 replies - 1 through 4 (of 4 total)
  • designsimply

    @designsimply

    Member

    If you want to exclude the most recent post from the loop, then you can use query_posts() with the offset parameter. Usually, index.php starts the loop with if (have_posts()), but if you want to use query_posts() and exclude the most recent post, then you would change it to if (query_posts('offset=1')). Be careful when editing template files, and don’t forget to make a backup before you begin.

    Nice solution. But when i use “if (query_posts(‘offset=1’))” instead of
    “if (have_posts())”, the navigation link (previous entries, next entries) doesn’t work. Url shows that it goes to the 2nd page, but the contents remain same.

    Can I have any solution please?

    3wlink, it works with the query OUTSIDE the loop 🙂

    <?php query_posts('offset=1'); ?>
    	<?php while (have_posts()) : the_post(); ?>
    			Post foo
    	<?php endwhile; ?>

    Ipstenu i have the same problem.
    I used it outside the loop and the navigation links doesn’t work either.
    What should i do ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] How to exclude most recent post’ is closed to new replies.