Is there a way to show custom page settings on specific page templates ONLY?
For instance I have a settings field: "Custom Settings". I don't want this to show on the "Default Page Template". I only want it to display if we select the "Custom Page Settings Page Template".
Here's my meta box code:
function cd_meta_box_add()
{
add_meta_box( 'icon-class-meta-box', 'Icon Class', 'ic_meta_box_cb', 'page', 'side', 'default' );
}
add_action( 'add_meta_boxes', 'cd_meta_box_add' );
function ic_meta_box_cb( $post)
{
$values = get_post_meta( $post->ID );
$selected = isset( $values['ic_meta_box_select'] ) ? esc_attr( $values['ic_meta_box_select'][0] ) : ”;
wp_nonce_field( 'ic_meta_box_nonce', 'meta_box_nonce' );
?>
<p>
<label for="ic_meta_box_select">Class</label>
<select name="ic_meta_box_select" id="ic_meta_box_select">
<option value=" " <?php selected( $selected, ' ' ); ?>> </option>
<option value="red" <?php selected( $selected, 'red' ); ?>>red</option>
<option value="blue" <?php selected( $selected, 'blue' ); ?>>blue</option>
<option value="green" <?php selected( $selected, 'green' ); ?>>green</option>
<option value="pink" <?php selected( $selected, 'pink' ); ?>>pink</option>
<option value="orange" <?php selected( $selected, 'orange' ); ?>>orange</option>
<option value="black" <?php selected( $selected, 'black' ); ?>>black</option>
</select>
</p>
<?php
}