I've made a custom search which includes a 3 tier custom taxonomy that looks like this:
continent - country - - state
The search is formatting in the above way.
Here is my problem:
Example data:
Taxonomy name = 'locations'. Custom post type = 'firms'.
America [term_id = 1]
- United States [term_id = 2]
- - Idaho [term_id = 3]
- - New York [term_id = 4]
- - Wisconsin [term_id = 5]
So how would I go about returning results for all firms with a 'locations' taxonomy PARENT of ID = 2 (United States)?
Let's say the user selects United States in the dropdown. There will be no results because for the 'firms' custom post type, the 'locations' taxonomy selected is always drilled down as far as possible to the state level. So for example a firm with 'locations' set as New York would not show up when a user searches for 'United states', because their 'locations' taxonomy ID is 4 (state level) and NOT 2 (country level).
Hope this makes sense... I was thinking of perhaps storing country level and continent level in post_meta and conditionally adding a meta query on the search page if the selection is not state level.
Any ideas? I think this is quite an interesting problem :-)
Thanks