Skip Navigation

[Resolved] 2-step filter

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1878231

Tell us what you are trying to do?
I try to set up a filter for a CPT called glossary.
First level is to select one of the two main categories - "medical" (no subcategories) and" food" (with subcategories).

When selecting "Food" a second filter should appear with the subcategories "Fruit", "Vegetables", "Fish" etc. along with a tag filter that applies to all food terms. (Checking the "food" checkbox should open this second list).

The search results would be
- medical: a list of glossary terms belonging to this category
- food: a list of glossary terms belonging to a subcategory of the "Food" category and/or a tag

Is this possible? If so, please set me on track.

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/views/filtering-posts-by-user-selected-taxonomy/

#1878441

Hello, unfortunately this type of split hierarchical taxonomy filter does not exist in Blocks/Views. The most similar split filter front-end experience that is offered is in the case of a chained, hierarchical series of one-to-many post relationships like Grandparent CPT > Parent CPT > Child CPT. Then it is possible to display split Grandparent and Parent filters in a custom search View displaying the Child CPT. You can see how this scenario is implemented in the reference site here: https://real-estate.discover-wp.com/find-property/

In this case State is the Grandparent CPT, City is the Parent CPT, and Property is the Child CPT. If you'd like to know more about how this is set up in wp-admin, you can create a free account at https://discover-wp.com and create your own real estate sandbox site. I'll be glad to provide more information about that if you need assistance.

#1878447

I see.
So in my case State Would be equivalent to my main categories Medica and Food, and City would be the subcategories of Food, while Property would be the CPT itself, right?
Can I define Grandparent, Parent en Property using the CPT category taxonomy?

I'll give it a try on an sandbox site and get back to you later on.
Thanks!

#1878569

So in my case State Would be equivalent to my main categories Medica and Food, and City would be the subcategories of Food, while Property would be the CPT itself, right?
Yes, that's correct. You would create one custom post type (this will be the Grandparent post type) that includes two posts: Media and Food. Then you would create another custom post type that includes posts that correspond to each subcategory of Food (this will be the Parent post type). Your Glossary post type would be the Child post type. Then you would create a one-to-many relationship between Grandparent and Food. Then you would also create a one-to-many relationship between Food and Glossary.

Can I define Grandparent, Parent en Property using the CPT category taxonomy?
I'm not sure I understand what you mean here. Taxonomies and Post Types are different things. Types Post Relationships only apply to post types, not taxonomies, so you cannot define post relationships between taxonomies. You can only define post relationships between post types. Please clarify if you need additional information about that.

#1880297

I tried to install a sandbox site as you suggested, but the Blocks and Maps plugins are missing and I don't see a way to install them. Please help!

#1881547

Hi, I'm asking my systems team to take a look. It seems that some plugins were not updated correctly after the last round of plugin releases. That should be resolved soon. In the meantime, if you want to install the reference site on your own test environment, you can download the Framework Installer plugin from the bottom of the page here: https://toolset.com/account/downloads/#application-frameworks

#1883893

I defined grandparent and parent relationships as you suggested and set up a view in my local install.
But when I try to select an item in Rubrieken the dropdown is empty; the 2 options I defined don't appear.
Any idea how to fix this?

#1884313

I'm not sure from your earlier description what Rubrieken means. If it is one of the ancestor post types, then it may be a case where the ancestor posts are not related to any child posts and the filter option "Show only available options for each input" is selected. When this option for custom search Views is active, not all filter options will be displayed automatically. Only those options are available that would produce search results. So for example, if you have two grandparent posts "A" and "B", but those grandparents are not related to any parent posts or those grandparent posts are only related to parent posts that are not related to any child posts, then those grandparent posts would not appear in the grandparent post filter.

It's hard to say for sure without being able to see the filters and configurations. If you post it on a test site somewhere and provide a login in the private reply fields here, I can take a closer look. Or if you set up a similar scenario on a reference site at discover-wp.com, you can invite me as a User and I can log in there. I will provide my email in a private message if you'd like to collaborate on discover-wp.com.

#1885149

I invited you to my test site hidden link where I recreated my setup.
Grandparent = Rubrieken (Medische termen and Voeding)
Parent = Voedingsgroepen (grandparent = voeding)
Children = Encyclopedia Terms
Search page = /woordenlijst

I guess the problem is that only one of the 2 grandparents is related to a parent.
Terms within the category Medische Termen should be connected directly to the grandparent Rubrieken.

So if a user selects Rubrieken s/he should immediately see a list of term in the category Medical terms.
If Voeding is selected a second filter should appear containing the subcategories of Food.

Is that possible?

#1885929

Correction: Terms within the category Medische Termen should be connected directly to the grandparent Rubriek "Medische termen" if possible.

#1888737

The system I was describing is a hierarchical system. Grandparent > Parent > Child. Children cannot be directly connected to Grandparents.

It looks like neither "Voeding" nor "Medische termen" is connected to any "Voedingsgroepen" post. That's why there was nothing showing in the "Rubrieken" filter on this page: hidden link

I have connected "Fruit" and "Voeding" so you can see how this would work, and now some filter options appear here:
https://call-test-site.discover-wp.com/woordenlijst/

#1890885

OK, I see.
Is there another way to achieve my scenario:
1. User selects either medical terms or food.
2. If medical terms is chosen: user gets a list of terms in the category medical terms
3. If food is chosen: user gets a list of subcategories of the food category; after submitting s/he gets a list of terms in the chosen (sub)categories.

#1890943

Not exactly, because the post relationship filter requires each child to have a parent post. For a similar result, you could create one Voedingsgroepen post called Any Medical Term. Then connect all the Medical Term posts to the parent Voedingsgroepen post Any Medical Term.

#1891503

My issue is resolved now. Thank you!