Forums Forums Search & Filter Pro Multiple category fields

Viewing 10 posts - 1 through 10 (of 12 total)
  • Anonymous
    #190750

    Hi there,
    I have a category structure like this example:
    A(50)-> A_1(50) -> B_1(10), B_2(20), B_3(20)
    A(50)-> A_2(50) -> C_1(11), C_2(39)
    A(50)-> A_3(50) -> D_1(5), D_2(25), D_3(20)

    A, A_x, B_x, C_x and D_x are categories, the numbers represent the posts in each category.
    A is the parent category. A_x are the child category of A category. B_x are the child categories of A_1 category, C_x….you get the point. Each of the 50 articles, is present in each A_x child categories.

    Now I would like 3 fields for categories A_1, A_2 and A_3 so that the user can specify exactly the category combination for specific posts (e.g. all the posts which belongs simultaneously to categories B1, C1 and D3).

    I tried but I don’t know how to accomplish that. Any suggestions?

    Thanks

    Trevor
    #190777

    You need to separate out groups, branches or parent/child tags into separate custom taxonomies. In general, you can use a particular Taxonomy, such as Product Category, (or Category/Tags, each Taxonomy and each Custom Field) only once in the form. This post tries to explain this a bit better (you can use a plugin to switch category terms from category to any new taxonomy that you make, so it is not so hard to do). It is a really awful preachy lecture I wrote:

    https://support.searchandfilter.com/forums/topic/multiple-categories-combination/#post-55166

    Sorry about the tone, but the message is right and it links to good plugins (except taxonomy switcher I think).

    Anonymous
    #190801

    ok thanks for your answer.
    So let’s suppose I convert the category in three different custom fields which correspond to categories A_1, A_2 and A_3.
    Can I add then 3 filters in the search form, one for each custom field?
    It seems to me I cannot use the same filter more than once anyway.

    Trevor
    #190809

    They would be Custom Taxonomies, and yes, as you would now have three, you can have three fields in the form.

    Anonymous
    #190817

    By using the Post Meta Fields, am I right?

    Why do you suggest using the ACF plugin rather than the wordpress core custom fields directly?
    Installing ACF I would not loose all my already existing custom fields right?

    Trevor
    #190821
    This reply has been marked as private.
    Anonymous
    #190823

    Up to now I have them divided by that complex category hierarchy. However I could even add some additional custom fields to each posts if this is the only way to make it work.

    Trevor
    #190825

    I was suggesting adding custom taxonomies, not custom fields.

    Anonymous
    #190827

    ok you are right, custom taxonomies are more suitable for this purpose. Anyway this could be achieved also with custom fields right?

    Trevor
    #190829

    It could, but if you already have the data terms added to the posts as taxonomies (which categories are), then it would be easier to switch them without re-entering data.

Viewing 10 posts - 1 through 10 (of 12 total)