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.

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
$my_query->query($args);

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

wp_pagenavi();

// RESET THE QUERY
wp_reset_query();
?>

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

share|improve this question
add comment

1 Answer

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
add comment

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.