Skip Navigation

[Resolved] Conditional Taxonomy

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by bradB-2 6 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#1132222

I have 6 separate "regional" taxonomies. (Continents, Countries, National Divisions, Divisional Regions, Major Civil Divisions, Minor Civil Divisions).

When a user is submitting content, I want them to choose a value in each of these 6 taxonomies. However I would like them to display conditional values.

For example if the user chooses "North America" under the continent taxonomy, I would like only North American Countries to be available under the Countries Taxonomy, and continue on down the line through all 6 Taxonomies.

I am open to setting this up a different way, I have custom post types set up that match the 6 taxonomies and their values as well.

Thanks in advance,
Brad - leaftraders.com

#1132632

Hi Brad,

Thank you for contacting us and I'll be happy to assist.

Unfortunately, the CRED form doesn't support such conditional filtering and this will require custom programming.

Although 1-1 custom programming of this extent is beyond the scope of support that we provide, following points should help:

1. Since taxonomies cannot be linked together with each other, I'll suggest to remove them and use custom post types for segmentation ( i.e. Continents, Countries, National Divisions, Divisional Regions, Major Civil Divisions & Minor Civil Divisions will all have a custom post type of their own ).

2. You'll be able to link these custom post types using relationships, as explained in this guide:
https://toolset.com/documentation/post-relationships/

3. In your CRED form, you can add generic fields and then populate their options, using AJAX calls and Select2 script library.

Following are some useful resources on these topics:

https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/
https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_(action)
hidden link

4. As the last step, you'll be able to process and save the submitted data from this form using the CRED form's "cred_submit_complete" hook, as needed.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_submit_complete

For a personalized and detailed assistance around custom programming, you can consider hiring, one of our certified consultants:
https://toolset.com/contractors/

I hope this helps.

regards,
Waqar

#1135773

My issue is resolved now. Thank you!