• 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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • What theme are you using? Where did you download it from?

    Thread Starter oakley56fila

    (@oakley56fila)

    I’m using the CherryThemes framework with childtheme template_44016 which I’ve been customizing.

    They were both provided to me via the designer and were obtained from https://www.templatemonster.com/.

    Thread Starter oakley56fila

    (@oakley56fila)

    I created a new page named ‘Advice’ and set it to display a specific template. This template is a copy of my category.php template but I’ve added the following code:

    if ($_GET["catid"] != "") {
    	$args = array('cat' => $_GET["catid"], 'paged' => $paged );
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($args);
    }

    This allows me to set the category ids via the link’s URL by appending ‘?catid=76,77’. For instance, the advice page is located at https://www.example.com/advice/, I’m adding ?catid=76,77 to the end of that to make https://www.example.com/advice/?catid=76,77. This is working for me perfectly. It’s displaying posts from both category 76 and 77 and it is not breaking the pagination.

    The issue I’m still having is that I don’t want to create 31 different pages within WordPress… there should be a more intuitive way. Being as I had only added code, and not taken anything away, I decided to try to integrate this directly into the category.php template. The thought here being that if the catid variable isn’t set, it wont trigger the code and all should work as normal. This is correct, however, the pagination issue returns when using the code in this manner. It seems as if the root category in the URL is being used for the pagination instead of the two categories that have been set.

    So I’m wondering, for the sake of pagination, what information is acquired from the URL when viewing a category?

    What would be the cause of the pagination for ‘https://www.example.com/advice/’ (a non-category page running off of a derivation of the category template) be processed differently than ‘https://www.example.com/category/advice/’ when they are running off of the same code?

    I’m sorry but as you are using a non-WPORG theme, you need to seek support from the theme’s developers – paid or otherwise. We only support themes downloaded from www.remarpro.com here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Issue with from two categories, pagination.’ is closed to new replies.