WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

closed as off-topic by Pieter Goosen, cybmeta, Pat J, birgire, gmazzap Nov 27 '14 at 14:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the 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
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

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