Support » Themes and Templates » end of category.php producing 404 error

  • Hi,

    I’m having a problem with my category.php template. When I read the end of my posts, i.e. when there are still a few posts but not enough to fill up a category page, it spits out a 404 error rather than showing those last few posts and just stopping to go backwards. You can see this here if you click ‘next’ at the bottom of the page:

    I haven’t been able to figure this out. Would anybody have any ideas as to why I get a 404?


Viewing 7 replies - 1 through 7 (of 7 total)
  • Does the template use a custom query (eg query_posts())?

    Yes it uses the following query that I got off these forums. I use it to limit the number of posts per page for different categories:

    <?php if (is_category('CATEGORY-NAME')) { $posts = query_posts($query_string . '&orderby=date&showposts=3'); } ?>

    Try changing it to:

    <?php if (is_category('CATEGORY-NAME')) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $posts = query_posts($query_string . '&orderby=date&posts_per_page=3&paged =' .$paged ); }

    Thanks, but no luck, it is still producing a 404. Would there be another way to limit posts per page? Or another way to have multiple loops on a category page, i.e. without using wp_reset_query (which I assume breaks the category)

    The method you’re using is the one I’d suggest. Assuming you’re using a custom permalink structure, does the problem still occur with default permalinks?

    If you remove the custom query and limit the posts per page to via Settings/Reading, does it still happen?

    Hi, sorry for the delay but finally got a change to test it out. If I remove the query and set the posts per page via admin settings it works fine, and if i put the query back in there while disabling my custom permalinks it also works fine.

    Any suggestions on how to incorporate this along with my custom permalinks? I’ve really got my heart set on them.

    If anyone runs into this same problem set your posts per page to 0, and check out this thread:

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘end of category.php producing 404 error’ is closed to new replies.