Category restriction

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 4 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #18787
    diegomoreno
    diegomoreno
    Participant

    Good Morning

    I need help to configure the behavior of filters by category.

    I need to filter the publications on my “Recipes” page, and these are identified with two main categories: By Color and By type.

    The idea is that when a category is selected, only the publications identified with that category name are shown, either a By Color or By Type category, even if the publication is identified with a different category, since some publications can be categorized by color and by type at the same time.

    But, I want that when you select a category color and a category by type, only those color publications that also belong to that type are displayed.

    Just now when you select color it shows all the color publications, but when you select a type, it shows all the categories of the type even if other colors exist.

    I explain myself well?

    #18796
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I think I understant exactly.

    This might be very problematic (might be even impossible), because the color and type are not separete taxonomies, but within the same taxonomy ‘category’.
    The only closest possible solution is to try this option: https://i.imgur.com/SSxCHSD.png
    However this option will make sure that only compare the ‘checked’ checkboxes against the matches. Alll the results must match all the checked checkboxes though. So if you select more than one color and type, then it is very likely you won’t get any results.

    If the color and the type were in a separate taxonomy, then the current configuration would work perfectly, as there would be two separate filters, which would be compared by a separate logic. In that case if you checked any colors and any number of types, then you would get results matching at least one color AND at least one type at the same time.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #18800
    diegomoreno
    diegomoreno
    Participant

    Hi, thanks for your response

    The first option you offer does not work for me because it would be very strict and would not work well for users.

    On the other hand, the second option, where you talk about the separated categories seems more interesting to me. But I do not know how to separate the categories and create the necessary logic for the categories to interact with each other.

    Can you share with me information about it?

    #18807
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Sure, I think this includes all the information:
    https://codex.wordpress.org/Taxonomies
    https://codex.wordpress.org/Function_Reference/register_taxonomy
    https://wordpress.org/plugins/tags/custom-taxonomies/

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.