0
votes

I have a custom post type created, with custom meta boxes for it setup and a custom taxonomy type for that post type. Now I'm looking to (i.e. Via jQuery) display certain meta boxes based on the taxonomies selected (each taxonomy has different options that needs to be filled out)

Any suggestions on the best way to go about this or if it's even possible?

I've got the bulk of the work done I just need to conditionally display (a) specific meta box(s) based on the taxonomy(s) selected..

1
Attach an on change function to your taxonomy check boxes and then show/hide the related meta box. - Jrod
I think you're looking for dependent dropdowns. stackoverflow.com/questions/5910281/… - Matt
@mkaatman I really didn't want to use dependent dropdowns since multiple taxonomy items can be selected. I mean there is multiple select, but in this case that's no an option (UX purposes). - Braunson
@Jrod, how would you do this, do you mean you would do this via code dynamically or hard code it? - Braunson
@braunson I've updated it slightly, what functionality is missing? It seems like you're accomplishing my understanding of what you're trying to accomplish. jsfiddle.net/PADk2/1 - Matt

1 Answers

0
votes

So the entire goal was to have custom meta boxes display for the on selection of different taxonomies (each taxonomie displays a different meta box with different options). It seems there's no way to dynamically achieve this as of yet so the only solution is this.

  1. Code up the various metaboxes for each taxonomy within functions.php
  2. Assign the boxes to be hidden a certain class to display:none and on check of the slug of the taxonomy that matches the metaboxes id, display the box.

This was also informative when injecting JS into the Wordpress backend for a speciflc content post type / page. https://wordpress.stackexchange.com/questions/1058/loading-external-scripts-in-admin-but-only-for-a-specific-post-type

Answered.