This time I am going to explain how to exclude the latest article from the WordPress loop.This is because when I had redesigned my site, latest article (first article) has the different layout than the other one.Even you can see in my site home page.It’s the first article has a different layout than other articles.
So, In this article I am going to explain to you how to use the offset parameter in query_posts
function to exclude latest posts from the WordPress loop.
For that, you need to place following line of code before your loop.
1 2 3 | query_posts('offset=1'); |
Must Read: To import terms from csv in wordpress
After adding above line of code you can see your code will look like this
1 2 3 4 5 6 | query_posts('offset=1'); while ( have_posts() ) : the_post(); endwhile; |
Here offset will exclude the latest post and display all other articles.
That’s it.That’s a very simple way, a WordPress provide the very easiest way for customization.I hope this will help you.
Read about: Last Record from loop in WordPress
Don’t hesitate to use this code in your WordPress projects and post your comments if you need help. As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.