Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Include AND exclude category

Viewing 10 posts - 1 through 10 (of 19 total)
  • Jeroen bakker
    #197296

    Hi, In a search form I want to include one category AND exclude one category. the problem is I can only choose either include OR exclude. is there a way to do what I want?
    thanks

    Trevor Moderator
    #197301

    You may be able to do it using custom code, but it is not possible in the plugin settings. You would have to use the Edit Query Arguments filter.

    Jeroen bakker
    #197355

    Hi thansk, I am not a programmer. could you please provide me with an example where one category (a number) is excluded from the from.
    I guess i have to put it then in my functions.php ?
    many thanks
    cheers, jeroen

    Trevor Moderator
    #197361
    This reply has been marked as private.
    Ross Moderator
    #197622

    Hi Jeroen

    Sorry for the delay just picking this up now.

    I have a question regarding the logic of what you are trying to do.

    Including and excluding are not technically possible.

    By default, everything is included.

    So if you include a single category, all results will be restricted to what you just included, meaning, every other category will be automatically excluded (in effect), meaning you shouldn’t need to exclude anything else.

    Take this example, a list of categories:

    Blog
    Design
    Development

    If I included “Design”, then the search would be limited to only:

    Design

    So Blog and Development would be excluded already – and there would be no need exclude anything.

    Does that make sense?

    Thanks

    Jeroen bakker
    #198257

    Hi ross, I understand what you mean. The problem is that I have about 20 categories and 10 search forms. There are forms where i want to include one category and exlude another, otherwise I have to exclude all categories which is quite some work.. But if there is no other way, I have to rest my case

    Jeroen bakker
    #198259

    Ross, the exluding way does not work, I have a category aardrijkskunde which is ID 104, if I only include 104 the right results are shown, but if I exlude all categories except 104 (meaning id’s 155,98,157,103,154,139,133,158,156,106,1,101,99,97,140,159,105,100,9,113,102) I have no result at all.
    Hope you can help

    Ross Moderator
    #198328

    Hi Jeroen

    Is it possible that when you exclude all other categories, that that you get no results, because the results have multiple categories?

    So when you might expect there to be results when excluding all except 104, you don’t get any, because the results that would be in 104, also share some other categories which are in the exclude list?

    Your original question states you want to include one category, and exclude another, surely, just doing an “include” on one category works because it excludes the others?

    If I’m getting confused, please explain with clear example which outlines a few posts, what categories they have, and what settings do / do not work.

    Thanks

    Jeroen bakker
    #198716

    Hi ross,
    On the page https://www.itsacademy.nl/aardrijkskunde/ you see a filter which only shows the results from category ‘Aardrijkskunde’. All posts indeed have more than one category.

    When i want to exclude all posts in the results on this page with the category ‘Archive’, I indeed tried to exclude all categories except for ‘Aardrijkskunde’ and ‘Archive’, but that does not work because the postst have more than one category (like you say yourself).

    Do you see any solution to this? So is there any possibility to show results fromn category aardrijkskunde but not from category Archive?

    thanks

    Ross Moderator
    #199537
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 19 total)

You must be logged in to reply to this topic.