Home › Forums › Feature Requests › Conditional Logic using Taxonomy field › Reply To: Conditional Logic using Taxonomy field
@Intrepidrealist basically I created my taxonomy field through ACF, then injected some javascript into the page to show / hide various elements depending on the value of the selected taxonomy term.
To load the custom js I hooked into acf/input/admin_head, the docs here explain how to do that pretty well: http://www.advancedcustomfields.com/resources/acfinputadmin_head/
I then used the acf/setup_fields event in jQuery to do the hiding / showing. This doc page explains how to do it: http://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/?version=4
After that it was just vanilla jQuery to do the heavy lifting.
Hope that helps
EDIT – unfortunately my code is pretty specific to the fields and post types involved so what I’ve written isn’t something you could really copypasta into your own project – but hiding / showing divs using jQuery is something you’ll be able to find plenty of help with online.
The only difficult part is finding out what the IDs of the fields and containing divs are, you’ll need to spend some time in Firebug to get an idea about what to target.
Cheers
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.