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

I have an archive.php page with the following code:

<?php // Start your custom WP_query
$my_query = new WP_query();

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' ?> 1, 'paged' => $paged, 'category_name' => 'Casino Slots');
// Assign predefined $args to your query

// Run your normal loop
if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
<?php endwhile;
else :
// do stuff for no results



and it displays the posts fine, but the pagination never shows?

share|improve this question
up vote 3 down vote accepted

I think your issue is that wp_pagenavi() is doing pagination based off of the global $wp_query instance instead instance you created. You should either switch to using query_posts() to replace the global query instead, or use WordPress' built in paginate_links to output the paging.

share|improve this answer
+1 - I think this is similar to the problem i was describing here, wordpress.org/support/topic/… – t31os Jan 24 '11 at 10:53

Your Answer


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.