0

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/

edit:

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

4
  • does index.php contain any custom queries?
    – Michael
    Commented May 28, 2012 at 15:42
  • Yes it does. The theme is using something called wizypanel. Should I paste my index.php?
    – bran
    Commented 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
    Commented May 28, 2012 at 16:18
  • removed pasterbin after the problem was solved. For security reasons.
    – bran
    Commented May 28, 2012 at 22:42

1 Answer 1

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 ) ); } ?>
3
  • Put it right before $blog = new WP_Query
    – Chris_O
    Commented 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
    Commented May 28, 2012 at 22:14
  • I was missing the end parenthesis in the wp_pagenavi function. Try it again.
    – Chris_O
    Commented May 28, 2012 at 22:33

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