Parent/Child Categories with Conditional Fields — Best Practice?
-
I’m building a local business directory with one Places CPT. I currently have about 20 main/parent categories and roughly 200 child/subcategories.
I created category-specific fieldsets using Conditional Fields. For example, Food & Dining has its own fieldset with restaurant-specific fields.
The issue is that if a user selects only a child category such as Mexican or Breweries, the parent Food & Dining category is not also selected, so the Food & Dining conditional fieldset does not appear.
I want the user experience to be simple: choose the specific business type, and automatically see the fields associated with its main parent category.
What is the recommended GeoDirectory setup for this?
Specifically:
- Is there a native setting, hook, or supported method to automatically assign/select a parent category when a child category is selected?
- Can Conditional Fields detect that a selected category is a descendant of a parent category, rather than requiring every child category ID to be entered manually?
- Is there a supported parent-first / child-second category selector for the Add Listing form?
- If not, what is the recommended architecture for a directory with many parent and child categories that also needs category-specific conditional fields?
I’d like to avoid manually maintaining hundreds of child-category IDs in conditional rules if there is a cleaner supported approach.
You must be logged in to reply to this topic.