How to Exclude Latest Post from the WordPress Post Loop

99

Excluding latest posts from the loop and/or offset posts in the loop is one of the things that comes in handy when editing or designing themes. In this article we will show you how you can use the offset parameter in wp_query function to exclude latest posts from the WordPress post loop.

First you will need to find the loop that you are working with. Then you will need to add the following parameter:

query_posts(‘posts_per_page=5&offset=1’);

This query is telling the loop to only display 5 posts which follow the most recent post (1). The important part in this code is “offset” and this magic word is doing the whole thing.

Your loop code should look like:

<?php
query_posts(‘posts_per_page=6&offset=1’);
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>

This should be it. If you have any questions feel free to ask via comments.

Source: WP Codex

Social Media Auto Publish Powered By : XYZScripts.com