BlogThemes

How to Exclude Latest Post from the WordPress Post Loop

Excluding newest posts from the loop and/or offset posts within the loop is likely one of the issues that is useful when enhancing or designing themes. On this article we’ll present you ways you should utilize the offset parameter in wp_query operate to exclude newest posts from the WordPress publish loop.

First you have to to search out the loop that you’re working with. Then you have to so as to add the next parameter:

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

This question is telling the loop to solely show 5 posts which comply with the newest publish (1). The vital half on this code is “offset” and this magic phrase is doing the entire thing.

Your loop code ought to seem like:

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

Download The WPSaviour App Now

Related posts
Beginner’s GuideBest WordPress PluginsBlog

9 Best Social Proof Plugins for WordPress & WooCommerce (2020)

Tips

How To Disable The WordPress User Admin Toolbar

Tips

WordPress Front Page vs Homepage

Tips

5 Things You Must Avoid Doing in WordPress

Leave a Reply

Your email address will not be published.

Pay in your preferred currency
Indian rupee
Euro