switzern
Member
Posted 2 years ago #
When my site is displaying a category for which I have a custom template, the navigation below the posts isn't working.
When I change the reading settings to display 20 posts, I am able to see all the posts, but when I decrease the number to 10 posts per page I can only see the first 10 posts because the post navigation gives me a 404 error.
You can view the error on this page:
http://scottleekimball.com/the-series/
Scroll all the way down to the bottom and click on the navigation to see the second page of posts.
I'm using the same navigation on this page:
http://scottleekimball.com/chronology/
So, I'm not sure what could be causing that navigation to break in that first page.
Thanks in advance.
Try dropping a copy of your custom category template file into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.
switzern
Member
Posted 2 years ago #
Thanks for the tip, esmi.
Here's the pastebin URL to the custom category template that's giving me problems:
http://wordpress.pastebin.ca/1841740
I'm using the WP Pagenavi plugin, but I've tried reverting to default navigation and that gave me the same error.
Try replacing:
<?php global $query_string;
query_posts($query_string . "&order=ASC");
?>
with:
<?php global $query_string;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($query_string . "&order=ASC&paged=" . $paged);
?>
switzern
Member
Posted 2 years ago #
I replaced the block of code you suggested, but I'm still getting the error on this page:
http://scottleekimball.com/the-series/
I dropped the updated template in pastebin:
http://wordpress.pastebin.ca/1842491
I'd appreciate any more suggestions you might have.
Thanks for your help!
Let's try another tack. Updated code: http://wordpress.pastebin.ca/1842673
switzern
Member
Posted 2 years ago #
Hmm...still getting the same error.
Are there any other Loops running in that page? In the sidebar or elsewhere?
switzern
Member
Posted 2 years ago #
No, that's the only loop.
Here's my category.php template, which the nav works on.
http://wordpress.pastebin.ca/1842937
switzern
Member
Posted 2 years ago #
Something else strange I just noticed:
When I delete that custom template from my theme directory, so the category that's giving me trouble is using the generic catgory.php template (pasted above) I still get them same 404 error when I click on the nav.
Is it possible this isn't a template coding error?
I was beginning to wonder if it was the wp_pagenavi plugin? Or another plugin? Try deactivating all plugins except wp_pagenavi to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).