Skip to content

Instantly share code, notes, and snippets.

@sky4git
Created May 18, 2015 12:27
Show Gist options
  • Save sky4git/321c2d9cfb458b17b805 to your computer and use it in GitHub Desktop.
Save sky4git/321c2d9cfb458b17b805 to your computer and use it in GitHub Desktop.
Option tee add meta boxes to page template
// ref: http://themeforest.net/forums/thread/option-tree-metabox-and-page-templates/75063
$post_id = (isset($_GET['post'])) ? $_GET['post'] : ((isset($_POST['post_ID'])) ? $_POST['post_ID'] : false);
if ($post_id) :
$post_template = get_post_meta($post_id, '_wp_page_template', true);
if ($post_template == 'template-home.php') ot_register_meta_box($my_meta_box);
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment