Forums › Forums › Search & Filter Pro › Dynamically populate dropdown
- This topic has 8 replies, 4 voices, and was last updated 9 years, 6 months ago by
Anonymous.
-
Anonymous(Private) October 21, 2014 at 4:37 pm #6250
It’s possible to populate category dropdown, based on the previous category dropdown
Exampl
Got a dropdown of countries, when I select one I will need that the second dropdown show the wordpress subcategory of previous dropdown, examples cities of the previous selected country.
Ross Moderator(Private) October 23, 2014 at 1:40 pm #6357Hey Raimundo, this is a feature I’m working on and will be released in the next major version.
Thansk
Ross Moderator(Private) May 15, 2015 at 3:17 pm #17592Nope not quite yet – I’m working on this right now – hoping for end of this month 🙂
Ross Moderator(Private) December 17, 2015 at 9:49 pm #32451Yup, just enable the “autocount” option in the general tab.
Then in your fields, make sure you tick “hide empty”.
This works for taxonomy fields, and post meta (only choice type) fields
Thanks
Anonymous(Private) December 18, 2015 at 8:54 am #32467Hi,
I can’t get it to work yet. I have a test environment here: http://valleitest.staging.wpengine.com/category-and-subcategory-testpage/
I have countries setup as main categories and cities within those countries setup as subcategories. I’ve added some posts and assigned categories and subcategories to them.
What I would like S&F to do is give me one drop down with countries only and then populate the second drop down with the subcategories (cities) of that country only.
First of all I can’t get the first dropdown to show me the countries only, it show categories and subcategories. Which field should I use for this? And how should I set this up?
And which field should I use for the second drop down, and how should I set this up?
Hope you can help me out, thanks, great plugin!!
Ross Moderator(Private) December 18, 2015 at 9:25 am #32468Ahhh I see – its because you are using a category field twice.
What you should do is have a taxonomy for countries, and another taxonomy for cities – then you can get this to work – see the restrictions here:
Also read further down on how to create new taxonomies – they’re just like tags and categories.
Thanks
Anonymous(Private) December 18, 2015 at 9:53 am #32470Hi Ross,
thanks for the quick response. What you are suggesting is actually what I had before, I just ‘dumbed it down’ to understand the possibilities.
Could you take a look here: http://valleitest.staging.wpengine.com/search-filter-shortcode-test/
The issue I have with this setup is that drop down 1 filters by category, but drop down 2 shows all subcategory possibilities (regardless of main category choice), not only the child categories (because there is no relation, since they are different taxonomies).
In case of countries that’s not really an issue, if a post is assigned to a city it’s obvious to which country it belongs, but we are working with ‘themes’ and it’s not always clear for the user which theme belongs to which main category…
Do you understand my issue? Any suggestions?
Thanks Ross!
-
AuthorPosts