Skip Navigation

[Resolved] Taxonomies filter

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.

Author
Posts
#1863397

Hi!
I want to do view with a search filter with a select menu that can relate to each other. Example:
Region (parente) > City (child 1) > Location (child 2)

My idea was to hide the children and show only after the parent is chosen with a conditional of AND maybe...
For now I have only a taxonomy named Locations that has Parents and Children, but I'm afraid this can only be done with custom fields and some conditional?

What do you think?

#1863811

For now I have only a taxonomy named Locations that has Parents and Children, but I'm afraid this can only be done with custom fields and some conditional?
Hello, unfortunately Toolset's conditionals aren't intended to work with custom search filter selections in a View. Conditionals are meant to test values in content, not filter options. There is no built-in way to create separate filters like this for each level of a hierarchical taxonomy. Views offers checkboxes, radio inputs, and select fields, but no options for separate fields for each level of a taxonomy.

Post Relationship filters can be interdependent and separated hierarchically, as you can see in the State and City search filters on the Real Estate Reference site here: https://real-estate.discover-wp.com/find-property/

In this scenario, you would create two One-to-Many (O2M) Post Relationships to accomplish something like this, where Region is a post type, City is a post type, and Location is a post type. There must be a O2M between Region and City, and another O2M between City and Location. You can add all ancestors to the Post Relationship filter to show select fields for all 3 post types.

You can create a free account at our sandbox site https://discover-wp.com and create your own sandbox Real Estate site to see how this search filter setup is implemented. Let me know if you'd like more information about the Post Relationship approach.