I have to get 2 categories worth of posts in one page (just testing with 1 category until the 404 gets fixed), so I have the following code. The first 10 posts are perfect, but when I try to navigate to page 2/3 etc, I get a 404…
What’s wrong with my code?
<?php get_header(); ?> <div id="content"> <h1 class="gotham"><?php single_cat_title(); ?></h1> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array ( 'paged' ?> $paged, 'cat' => 7 ); query_posts($args); while(have_posts()) : the_post(); ?> Yep <?php endwhile; ?> <?php wp_pagenavi(); ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
What is the link that wp_pagenavi generates? Can you change to next_posts_link() to see if that generates a different URL ?
- Sold between 250 000 and 1 000 000 dollars
- Community Moderator
- Author was Featured
- Item was Featured
- Bought between 50 and 99 items
- Referred between 1000 and 1999 users
- Has been a member for 3-4 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
Is this possibly the issue where you have a page and a custom post type with the same name/slug? Or colliding page/category/post/custom post slugs perhaps?
Might be worth looking at the details of this plugin, too: http://wordpress.org/extend/plugins/category-pagination-fix/