• Hey, I tried searching everywhere but I can’t find a good answer, how can I skip the latest post so it just shows the 2nd latest, etc.

    I assume I have to modify <?php if (have_posts()) : ?> to some extent?

    Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter kgst

    (@kgst)

    bump

    Could you not just do:

    <?php
    if(have_posts())
    {
         the_post();
         while(have_posts())
         {
              the_post();
              //Do whatever you need to here.
         }
    }
    ?>

    Thread Starter kgst

    (@kgst)

    sorry I’m pretty new to this, what exactly would I have to put in to make it skip the first post though?

    <?php
    query_posts('offset=1');
    if(have_posts())
    {
         the_post();
         while(have_posts())
         {
              the_post();
              //Do whatever you need to here.
         }
    }
    ?>

    Just add the above code instead of your code.

    Thanks

    To make it skip a post I think you just call the_post(); before entering your while loop. Each time you call the_post(); it gets the information of the next post.

    Okay. Then just add the following code.

    <?php
    query_posts('offset=1');
    if(have_posts())
    ?>
    
    offset=1 indicates, which post you have to exclude.

    If this don’t work, add the code which I have added in my previous reply.

    Thanks

    Thread Starter kgst

    (@kgst)

    Thanks Thejas, adding “query_posts(‘offset=1’);” worked great

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to skip the first post?’ is closed to new replies.