Issue with from two categories, pagination.
-
The theme that I’m modifying has a category template which I’ve renamed to category-[page id] in order to load a specific template when that category is viewed. Within that specific template, I’ve added
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($query_string . '&ignore_sticky_posts=1&cat=77,76&paged='.$paged);
As you can see, I’m pulling posts from two categories. This works just fine, but pagination does not.
The issue I’m seeing is this: I have two categories, category 1 has 18 posts, and category 2 has 1 post. When I create a template in the above manner for category 2, it displays the first 10 posts of both categories along with the ‘Older Posts’ pagination link at the bottom. This link 404s. When I reverse this, and set the template for category 1, the pagination functions as it should.
This leads me to two conclusions:
1) Using this method of combining categories the pagination is based off of the number of posts in the specific category for which the template has been applied.
and
2) This is likely not the best way of combining categories.After a bit of thought I realized that whenever anyone wishes to view the specific category for which I have setup these templates, they will instead be viewing both categories.
My questions: What is the best approach to display posts from two different categories on one page WHILE PRESERVING pagination THAT WOULD ALSO keep the original categories intact?
- The topic ‘Issue with from two categories, pagination.’ is closed to new replies.