Most of the wordpress developers will usually stuck on some simple issues with the wordpress functions. I have recently got stuck for 30 minutes on this simple issue with the While Loop.
Excluding the Latest Post from the Wordpress While Loop.
First we need to get a simple idea about query_posts() and How it works, and How it affect the loop.
For example
<?php
query_posts('posts_per_page=3&offset=0');
?>
This query will tell the loop to display 3 posts which includes the latest one too. Important point is that this “offset” is doing the Magic.
Your loop code should look like:
Hope this will help to save your pretious time.
Excluding the Latest Post from the Wordpress While Loop.
First we need to get a simple idea about query_posts() and How it works, and How it affect the loop.
For example
<?php
query_posts('posts_per_page=3&offset=0');
?>
This query will tell the loop to display 3 posts which includes the latest one too. Important point is that this “offset” is doing the Magic.
Your loop code should look like:
<?php
query_posts('posts_per_page=9&offset=1');
// offset=1 will remove the Latest post from our Loop.
if ( have_posts() ) :
while ( have_posts() ) : the_post();
the_title();
endwhile;
end if;
?>
Hope this will help to save your pretious time.