Created
January 7, 2014 22:45
-
-
Save mattie02/8308341 to your computer and use it in GitHub Desktop.
only pull meta for specific page-template superCpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(class_exists( 'Super_Custom_Post_Type' )){ | |
add_action( 'after_setup_theme','trusted_page_sup' ); | |
function trusted_page_sup() { | |
if ( isset( $_GET['post'] ) ) | |
$post_id = $_GET['post']; | |
elseif ( isset( $_POST['post_ID'] ) ) | |
$post_id = $_POST['post_ID']; | |
else | |
$post_id = get_the_ID(); | |
if ( ! $post_id ) | |
return; | |
if ( 'page' != get_post_type( $post_id ) ) | |
return; | |
if ( 'page-homepage.php' == get_post_meta( $post_id, '_wp_page_template', true ) ) { | |
$homepage_meta = new Super_Custom_Post_Meta( 'page' ); | |
$homepage_meta->add_meta_boxes( $attr = array( | |
'id' => 'Homepage Boxes', | |
'context' => 'normal', | |
'priority'=> 'low', | |
'post-type' => 'page', | |
'fields' => array( | |
'box-1-thumbnail' => array('type' => 'media'), | |
'box-1-title' => array('placeholder' => 'Title'), | |
'box-1-message' => array('type' => 'textarea'), | |
'box-1-type-of-button' => array('type' => 'select', 'options' => array( 1 =>'link', 2 => 'button'), 'prompt' => false), | |
'box-1-button-text' => array('placeholder' => 'Button Text'), | |
'box-1-button-link' => array('placeholder' => 'Button Link'), | |
) | |
), | |
$attr2 = array( | |
'id' => 'Homepage Boxes 2', | |
'context' => 'normal', | |
'priority'=> 'low', | |
'post-type' => 'page', | |
'fields' => array( | |
'box-2-thumbnail' => array('type' => 'media'), | |
'box-2-title' => array('placeholder' => 'Title'), | |
'box-2-message' => array('type' => 'textarea'), | |
'box-2-type-of-button' => array('type' => 'select', 'options' => array( 1 =>'link', 2 => 'button'), 'prompt' => false), | |
'box-2-button-text' => array('placeholder' => 'Button Text'), | |
'box-2-button-link' => array('placeholder' => 'Button Link'), | |
) | |
), | |
$attr = array( | |
'id' => 'Homepage Boxes 3', | |
'context' => 'normal', | |
'priority'=> 'low', | |
'post-type' => 'page', | |
'fields' => array( | |
'box-3-thumbnail' => array('type' => 'media'), | |
'box-3-title' => array('placeholder' => 'Title'), | |
'box-3-message' => array('type' => 'textarea'), | |
'box-3-type-of-button' => array('type' => 'select', 'options' => array( 1 =>'link', 2 => 'button'), 'prompt' => false), | |
'box-3-button-text' => array('placeholder' => 'Button Text'), | |
'box-3-button-link' => array('placeholder' => 'Button Link'), | |
) | |
)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment