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:

    I then used the acf/setup_fields event in jQuery to do the hiding / showing. This doc page explains how to do it:

    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.