Home › Toolset Professional Support › [Resolved] Create Dropdown filter with only a child-term of a taxonomy
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 |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
Tagged: Custom search, Views plugin
Related documentation:
This topic contains 14 replies, has 2 voices.
Last updated by tobiasF-3 4 years, 12 months ago.
Assisted by: Minesh.
I have a taxonomy with three hierarchical levels. Industry, department, jobs
I was able to create a Dropdown menu filter with The hierarchical items all showing up..
But I would now like to create a Dropdown-Menü menu filter with only the single levels showing up. One Dropdown-Menu filter for industry, one for departments and one for jobs. Otherwise the Dropdown gets too crowded and is not easy to use.
Is there a way to achieve this?
What is the link to your site?
Https.//www.silvertree.ch/Airtable
Thx a lot for your great support.
Tobi
Hello. Thank you for contacting the Toolset support.
I checked the following page: hidden link
As I can see with the above page there is a jobs filter added that is of type taxonomy. There is no way to display the dependent filters and divide the taxonomy for all three levels.
However, there is a workaround but for that, you need to change your structure from taxonomy to post type. Each level will be a new post type and you need to add the relationship between those. You can see the similar feature with our reference site here with the state and city dropdown:
=> hidden link
If you want to know more about how that State and City dropdown filter setup, you should try to create a test site on our free test platform discover-wp.com and feel free to play with that.
Hey Minesch, thanks for your answer. Yeah, I am aware of that option and I can try and set it up like that, it's just much more work for something that seems already almost there 🙂
If I setup the post types as you have described: is there a way to automatically copy the various levels of the taxonomy to the various different post types and connect them together? Otherwise, if I have to do that manually it's a lot of extra work for already existing databases with thousands of entries...
Thanks for your support.
Tobi
If I setup the post types as you have described: is there a way to automatically copy the various levels of the taxonomy to the various different post types and connect them together?
===>
No, there is no native solution but you can try this at your own risk:
- hidden link
Otherwise, if I have to do that manually it's a lot of extra work for already existing databases with thousands of entries...
==>
I understand that but then you should stick to taxonomy filter as there is no other choice.
Hey Minesh, thank you for your detailed advice. I went ahead and followed your tipp to change the taxonomies to post types. I have setup a post type for 'Languages' and one for 'Dialects'. I have created a relationship between the existing post type 'Contacts' and made languages a many-to-many relationship. Then I've added a one-to-many relationship between Languages and Dialects. I've then created a relationship form for Contacts and Languages and integrated it into the contacts single view. I was then able to select a Language for a contact from a dropdown menu.
Now my question: how can I set it up so when I select 'Languages' in the relationship form on the contacts page, that then in the next dropdown the relevant 'Dialects' show up and I can select the dialect for the contact?
Also, is it possible to set it up so I can select multiple languages and its connected dialects for a contact.
Thank you for your help.
Tobias
As you said you created many to many relationships between the post type 'Contacts' and 'languages'. As I understand you created a relationship form for 'Contacts' and 'languages', what are the dropdowns available with this form? I think it should be only displayed Contact and Languages select boxes. If no - Can you please share access details where you added the relationship form so I can check this further.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Now my question: how can I set it up so when I select 'Languages' in the relationship form on the contacts page, that then in the next dropdown the relevant 'Dialects' show up and I can select the dialect for the contact?
==>
Do you mean you want to allow user to select language from the languages dropdown added using the relationship form on the following page right bar?
=> hidden link
And, when user changes the language drop language dropdown, you want that the following "Dialects" dropdown should be updated automatically with the options belongs to the selected language option. If this is correct. There is no such feature available to update the relationship dropdowns automatically when you change the option from another dropdown.
Yes, that is exactly what I am looking for, thanks for double checking. Is there really no way of achieving this? This seems strange because I don't see much value then in the filtering options as described here:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/
So it's possible for filters but not for entering?
How would you then suggest a user enters for example. Country, state, city? This would mean that thousands of cities would always show up in a form (also from other countries), even if I have already selected a country before?
Looking forward on your thoughts how to solve this problem, thank you very much.
Tobias
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/
==>
As you may have noticed - the link you shared is applied to the view's when you add the relationship filter when you added it to view. There is no way to implement such filters with post-relationship form.
You are allowed to only filter the relationship select field options with the author attribute.
For example:
[cred-relationship-role role='child' author="$current"]
Please check how post-relationship form works:
=> https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/
=> https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/creating-new-connections-between-related-posts/
=> https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/editing-existing-connections-between-related-posts/
Hey Minesh, thx for your reply.
Yes, I understand that. But I am still wondering how this makes sense:
If I can set up a filter like in the example link for:
country - city - neighbourhood
How would you create a form that makes sense for the post type houses?
Because: how would you build a form for houses where you make sure that a user CANNOT enter things that do not exist if you cannot prefilter the content of the dropdown based on the previous selection.
Example:
countries: USA, Germany, Italy
cities: New York, LA, Berlin, Rome
neighborhoods: Brooklyn, Manhattan, Kreuzberg, Vatican
How can you avoid that I enter for a new home:
Germany, New York, Vatican?
There must be some way to allow only entries that are connected, otherwise the above link with the filters is of no use?
Sorry, but I have difficulties to understand how this should work otherwise.
Thanks so much for your patience.
Tobias
Let me explain again based on the example you shared:
Example:
countries: USA, Germany, Italy
cities: New York, LA, Berlin, Rome
neighborhoods: Brooklyn, Manhattan, Kreuzberg, Vatican
===>
You need here two relationships:
- Countries and Cities - one-to-many
- cities and neighborhoods - one-to-many
Now, the fact is that you can create a Relationship form for the specific relationship you created. You can not combine two relationships. so, as you can see with the above example, we have two one-to-many relationships.
So, you need to create two Relationship forms. You can not combine both forms.
=> First relationship form created using Countries and Cities
-- You will find two select fields there one for country and one for city
- when you select country/or country is already selected (when relationship form is added on single country page) , if you try to search for city, it will load related city posts belongs to currently selected country in the previous dropdown that are not connected to the country. I mean only those city which is not connected to the country.
=> Second Relationship form created using cities and neighborhoods
-- You will see two select fields there, one form city and one for neighborhoods
- when you select city/or city is already selected (when relationship form is added on single city page) , if you try to search for city, it will load related neighborhood posts belongs to the currently selected city in the previous dropdown that is not connected to the neighborhood. I mean only those neighborhood posts which is not connected to the city.
The difference is you need two relationship forms to connect your two relationship levels. This is how it works.
Now, on your page: hidden link
Where you added the following form;
=> hidden link
- The above form belongs to the languages-dialects relationship. And this relationship has no connection/relationship with the contact page you are displaying: contact/adrian-kammer/
- so, when you try to search for Dialects, as you set the form to display current page, it will try to search the Dialects belongs to your contact that is currently selected as adrian-kammer and there is actually no such Dialects.
=> hidden link
I see you want to attach your contact to identify to which Country -> City -> neighborhoods, but there is no filter available with post form or relationship form that will display the filtered results as when you select country, it should display associated city and when you select city, it should display associated neighborhoods.
I raised this requirement in front of concern people in our last meeting but to raise your voice, I would suggest you to file a feature request so that our Devs review it.
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Thank you Minesh, for taking the time for this thorough answer. So in short, if I understand correctly: what I want is currently not possible? But you have told the developers to think about it and you recommend me also putting a request for this feature? Correct?
In the meantime I have looked at the toolset real estate site. They solve it by just giving dropdowns for each element. So I will do the same: a dropdown for Languages and a dropdown for dialects.
A related question: how can I change the 'Search for a post' text in the dropdown? And also the 'Submit' text in the action button?
Thx for your continued support!
Tobi
New threads created by Minesh and linked to this one are listed below:
And another related question: I've managed to set up the filter for language and dialects almost identical than the one on the Real Estate demo site, but there is one imporant difference:
- when I choose the 'Languages' filter only, the list does not update to show the entries with those languages. it waits until I have also chosen a dialect
hidden link
- on the 'Real Estate' demo website, the list updates to show all entries for a state, even though the city is not selected.
hidden link
Where is the difference to my setup?
Thank you very much. Tobi
New threads created by Minesh and linked to this one are listed below:
https://toolset.com/forums/topic/split-how-to-implement-dependent-dropdown-with-custom-search/
Thank you Minesh, for taking the time for this thorough answer. So in short, if I understand correctly: what I want is currently not possible? But you have told the developers to think about it and you recommend me also putting a request for this feature? Correct?
==>
Yes, this is correct.
A related question: how can I change the 'Search for a post' text in the dropdown? And also the 'Submit' text in the action button?
==>
I've split the ticket here for both of the issues.
- https://toolset.com/forums/topic/split-create-dropdown-filter-with-only-a-child-term-of-a-taxonomy-how-to-change-the-submit-button-text-with-relationship-forms/#post-1387661
- https://toolset.com/forums/topic/split-create-dropdown-filter-with-only-a-child-term-of-a-taxonomy-how-to-change-search-for-a-post-label-for-dropdown-select-fields-of-relationship-forms/#post-1387665
Please feel free to close this ticket and open a new ticket with your every question you may have. This will help other users searching on the forum as well as help us to write correct problem resolution summery to which ticket originally submitted.
I am looking forward to this feature being added to toolset. Thx