I am faced with a particular issues dealing with metabox fields. I've added a select dropdown list to Pages post type and what I can not figure out is how to add additional metafields based on the value of the select box. I was thinking something like if (metaboxfield.value == 'value1') then display the code for the new metabox field?
Here is what I am trying to accomplish...I can't figure out how to pull the value of a select box.
<?php $page_meta_box = array( 'id' => 'page_meta_box', 'title' => 'Page Options', 'desc' => '', 'pages' => array( 'page' ), 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'id' => 'page_select', 'type' => 'select', 'choices' => array( array( 'label' => 'Value 1', 'value' => 'value1' ), array( 'label' => 'Value 2', 'value' => 'value2' ), // If value 2 is selected, display an additional select box ) ) ) ); ?>
From the front end it would be a matter of
$getPageSelect = get_post_meta(get_the_ID(), 'page_select', true);
I've been stuck on this for a while and have yet to figure out the best way to approach this. If someone could point me in the right direction, that would be much appreciated.