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 comments
Comments are closed.
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?
Comments are closed.
Calling
the_post()
is what advances the internalcurrent_post
counter thathave_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.You just have to set a new query and play with the parameter offset see documentation
will exclude the most recent post for example.