Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

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

1 Answer 1

up vote 1 down vote accepted

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 ) ); } ?>
share|improve this answer
    
Put it right before $blog = new WP_Query –  Chris_O May 28 '12 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 '12 at 22:14
    
I was missing the end parenthesis in the wp_pagenavi function. Try it again. –  Chris_O May 28 '12 at 22:33
    
Worked. Thanks! –  bran May 28 '12 at 22:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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