pagenavigation not showing the next page just linking back to the main page [closed]

I took a look at the index.php code and I’ll explain what’s going on.

The theme author is using 2 custom new WP_Queries but is not doing anything with the main global $wp_query object. When you click to the second page you get the same posts because there is no main loop present.

Neither of the secondary loops contain pagination parameters. To fix this assign the query_var page to a variable and add it to the query args array.

$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;

Add to array:

'paged' => $paged,

Next you need to tell WP pagenavi what query to paginate.

<?php if(function_exists('wp_pagenavi') ) { wp_pagenavi( array( 'query' => $blog ) ); } ?>

Leave a Comment