Pagination in custom query in a category page
-
Hi there,
In a category (I create category-123.php), I’d like to create a new custom query in order to show all the posts that have right parameters (custom fields).<?php $today = date("Ymd"); $paged = get_query_var('paged') ? get_query_var('paged') : 1; $query = new WP_Query( array('meta_key'=>'duedate','meta_value'=>$today,'meta_compare'=>'>=' , 'paged' => $paged,'posts_per_page'=>'20') ); if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?> <?php the_title();?><br /> <?php endwhile; ?> <?php wp_pagenavi(array( 'query' => $query )); ?> <?php else: ?> <?php _e('Sorry, no posts matched your criteria.'); ?> <?php endif; ?>
In this case page to is 404 error. could you please help me to understand where I’m wrong? Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination in custom query in a category page’ is closed to new replies.