Exclude Latest Post From Home Page Loop

In this tutorial. i’ll provide the code i tested which excludes the latest published post from your home page loop.

Simply copy this PHP from the view raw link in the Gist and paste it at the end of your child themes functions.php file using a code editor.

The code above simply removes your most recent published post from the home page loop and can also be easily modified to offset any number of posts from the posts page you select in your Reading settings.

The home page loop may also be called your posts page or blog page.

When you publish a new post, it will be removed from the loop until you publish another post.

Similar Tutorials & Code Snippets

2 responses to “Exclude Latest Post From Home Page Loop”

  1. Thanks Brad! I wish I had seen this post earlier!

    This code for offsetting posts is quite similar to what I discovered as well. If you or your readers are interested in adding a bit of additional code, you can configured the site to maintain pagination as well.

    Here is the additional code:
    [code]
    add_filter(‘found_posts’, ‘myprefix_adjust_offset_pagination’, 1, 2 );
    function myprefix_adjust_offset_pagination($found_posts, $query) {

    //Define our offset again…
    $offset = 1;

    if ( $query->is_posts_page ) {
    return $found_posts – $offset;
    }
    return $found_posts;
    }
    [/code]

    For an extended explanation of this code visit this tutorial: “How to offset posts in the Genesis framework without losing pagination”.

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks Steck

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.