WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category archive won't go back past page 3 (5 posts)

  1. mrmarkham
    Member
    Posted 1 year ago #

    I just created a new category archive template for one category, and it seems to be working fine apart from one issue: if you click the "older posts" link, it'll take you back to page three, but clicking it again gets you a 404.

    When I was creating this template, I initially did it as a separate file and created a page using that template as a way to test it out. That test works fine - it'll let you back up all the way to the first page of posts in that category.

    What could be different between a page and the category archive that would make it behave differently? And why would it get to the third page just fine but not be able to go any further?

    My query_posts call looks like this:

    query_posts( array(
    'posts_per_page' => 5,
    'cat' => '5',
    'paged' => get_query_var('paged')
    ));

    Thanks in advance if anyone has any thoughts!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Perhaps you need to look at category templates?

  3. mrmarkham
    Member
    Posted 1 year ago #

    A category template IS what I've created. Specifically the new one I've created is category-news.php, since the category in question is News. What I'm wondering is why it behaves differently as a category template than it does as a generic template.

  4. mrmarkham
    Member
    Posted 1 year ago #

    To clarify my potentially unclear wording in my initial post - there are 6 pages worth of posts in the category, but the URLs for pages 4, 5, and 6 return 404s even though the first three pages work fine. And they ALL work fine in the test page I set up. So frustrating!

  5. mrmarkham
    Member
    Posted 1 year ago #

    Oh, I think I've got it!

    I thought of a couple keywords to search for previous topics by that I hadn't tried yet, and managed to find this:
    http://wordpress.org/support/topic/custom-post-type-pagination-404-on-last-page?replies=4

    Setting the max posts per page to 1 fixed the issue! (Of course, now I have author archives and tag archives displaying 1 post per page, but that should be pretty straightforward to fix!)

    ETA: Just discovered that it also works if the max posts per page is set to 5, which is awesome since that's what I use throughout my site, so now I don't have to change anything. Just wanted to add this in case anyone else ever runs into the same issue!

Topic Closed

This topic has been closed to new replies.

About this Topic