Skip to content

Instantly share code, notes, and snippets.

@Clorith
Created October 29, 2014 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Clorith/92ed18ec3f447558047b to your computer and use it in GitHub Desktop.
Save Clorith/92ed18ec3f447558047b to your computer and use it in GitHub Desktop.
<?php
// This is your functions.php
function exclude_first_five_posts_home( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'offset', '5' );
}
}
add_action( 'pre_get_posts', 'exclude_first_five_posts_home' );
// This is theloop.php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
?>
<div class='one-post'>
<div id="post-<?php the_ID(); ?>" <?php post_class("post-caption"); ?>>
INSERT STUFF HERE
</div>
</div>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment