Skip to content

Instantly share code, notes, and snippets.

@manishsongirkar
Created April 5, 2012 08:55
Show Gist options
  • Save manishsongirkar/2309310 to your computer and use it in GitHub Desktop.
Save manishsongirkar/2309310 to your computer and use it in GitHub Desktop.
Add Metabox for Custom Templates
/* Add Below code where you are adding Metabox */
global $post;
$template_file = get_post_meta( $post->ID, '_wp_page_template', TRUE );
if ( $template_file == 'template-full-width.php' ) {
add_meta_box ( 'post_custom_field_id', __( 'Custom Field', 'rtPanel' ), 'rtp_posts_inner_custom_box', 'page', 'normal', 'high' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment