Skip to content

Instantly share code, notes, and snippets.

@erikyo
Last active May 8, 2018 20:56
Show Gist options
  • Save erikyo/782805de561246baed0615571230eaa0 to your computer and use it in GitHub Desktop.
Save erikyo/782805de561246baed0615571230eaa0 to your computer and use it in GitHub Desktop.
Include Sticky Post in Page Posts Count
$count_stickies = count(get_option( 'sticky_posts' ));
$ppp = 6;
$offset = ( $count_stickies <= $ppp ) ? ( $ppp - ( $ppp - $count_stickies ) ) : $ppp;
$args = array(
'posts_per_page' => $ppp - $offset
);
$loop = new WP_Query( $args );
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment