0

I want to display in the front page of my theme the first most recent post in the header and then continuing the loop in the main content section starting from the second to post and so on, how can i achieve this?

  • 2
    There are a number of questions here about formatting the first "n" posts differently. Look to right under "Related", though they may not be exactly what you are after. I have addressed similar things here, here, here, and other places as well I believe. Some of those might help (but @Milo's answer got my upvote) – s_ha_dum May 13 '13 at 21:09
3

Calling the_post() is what advances the internal current_post counter that have_posts() checks the value of within the loop.

With this in mind, you can call the_post() once outside the loop and use any template tags you wish, then run the loop as normal and it will pick up and continue from the second post.

the_post();
// this is the first post!
the_title();

// now the loop
while ( have_posts() ) :
    the_post();
    // starts at 2nd post
    the_title();
endwhile;
0

You just have to set a new query and play with the parameter offset see documentation

'offset' => 1 

will exclude the most recent post for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.