• Posts on our blog usually belong in more than one category. For example a post about a new Samsung phone could appear in both “Smartphones” and “CES”.

    The theme we’re using allows us to create curated, blog-style pages that display posts based on select categories. When you setup the page, you’re asked to tick the categories you want included (all other un-checked categories are excluded). The problem arises if a post has more than two categories, one that should be included and the other excluded.

    In my example, I setup a page that lists posts about CES, only including posts filed under “CES”. My Samsung story that belongs in two categories, “Smartphones” and “CES”, does not appear on this page. I assume this is because the page excludes posts filed under “Smartphones”, completely disregarding the call to include posts with “CES” as a category.

    Is there an argument I can add to my theme to address this issue? I have very minimal knowledge of PHP so you’d have to tell me what to write, and where to paste the code.

    Our site is https://www.gadgetmatch.com and our theme is Story from Pexeto.

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Guido

    (@guido07111975)

    Hi,

    Because this is a premium theme we are not able to take a look at the code of your theme. So best thing to do is contact Pexeto for this issue.

    Guido

    Thread Starter michaeljosh

    (@michaeljosh)

    They aren’t responding. Can I post the code of my theme here?

    Guido

    (@guido07111975)

    You can post everything here but because you’ve paid for your theme you should ask for support there. Besides that we on www.ads-software.com don’t have access to this theme.

    But are you working with subcategories by any chance? If you exclude a parent category, all subcategories are excluded too, I guess.

    Guido

    Guido

    (@guido07111975)

    But are you working with subcategories by any chance? If you exclude a parent category, all subcategories are excluded too, I guess.

    Forget this, I did not understand your issue at first.

    I did a test with a post with multiple categories and included and excluded 1 of the categories.. post should display when using the proper conditions.

    But I have a Pexeto account as well, so I have installed another theme from them… same issue! I will try to find the part you have to change.. If I’m not able to find it, you should contact Pexeto directly (not via ThemeForest).

    Guido

    Guido

    (@guido07111975)

    Hi again,

    Checked another Pexeta theme, I think file structure is the same. In file lib > functions > general(.php) I notice this to exclude the categories:

    $query->set( 'category__not_in', $excludeCat );  //exclude the categories

    The ‘category__not_in’ is causing this. I don’t know how to display posts with multiple categories in combination with this filter.

    So I advice you to post this question in the Hacks forum because this is not a Pexeta issue. Or open ticket on Pexeta site.

    Guido

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Exclude Category problem for posts with 2 categories’ is closed to new replies.