Using this on my index.php

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

Using plugin:

WP-PageNavi Wp Pagenavi Style

Not sure what information you need to help me fix this. So please let me know.

Site: http://www.slashgeek.net/


code of index.php http://pastebin.com/hThDBcyC

  • does index.php contain any custom queries?
    – Michael
    May 28, 2012 at 15:42
  • Yes it does. The theme is using something called wizypanel. Should I paste my index.php?
    – bran
    May 28, 2012 at 16:01
  • pasting the index.php code might be a good idea - possibly use the pastebin.com if the code is longer.
    – Michael
    May 28, 2012 at 16:18
  • removed pasterbin after the problem was solved. For security reasons.
    – bran
    May 28, 2012 at 22:42

1 Answer 1


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 ) ); } ?>
  • Put it right before $blog = new WP_Query
    – Chris_O
    May 28, 2012 at 21:53
  • assigning variable and array works fine i.imgur.com/TxlfS.png but adding pagenavi breaks it. Is there anywhere specific I should put the pagenavi code? I tried it before </section>.
    – bran
    May 28, 2012 at 22:14
  • I was missing the end parenthesis in the wp_pagenavi function. Try it again.
    – Chris_O
    May 28, 2012 at 22:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.