Skip to content

Instantly share code, notes, and snippets.

@akmur
Last active August 29, 2015 14:01
Show Gist options
  • Save akmur/c93e54d0285c3c4b1db1 to your computer and use it in GitHub Desktop.
Save akmur/c93e54d0285c3c4b1db1 to your computer and use it in GitHub Desktop.
Pagination of custom loops with pagenavi
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
// WP_Query arguments
$args = array (
'post_status' => 'published',
'paged' => $paged,
'post_per_page' => 10
);
// The Query
$query = new WP_Query( $args )
// if... while... endwhile
wp_pagenavi( array( 'query' => $query ) );
wp_reset_postdata();
// endif...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment