Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Step 01: Set pages as 'page' like follows:
- 'pages' => array( 'page' ),
- Step 02: While declare the metabox function, use this code:
- $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
- $template_file = get_post_meta($post_id, '_wp_page_template',TRUE);
- if ($template_file == 'pricing.php') {
- ot_register_meta_box( $pricing_page_meta_box );
- }
- //here pricing.php is the Template Page file.
- Your Code should Look like this:
- $pricing_page_meta_box = array(
- 'id' => 'pricing_page_meta_box',
- 'title' => __( 'Our Service Custom Fields', 'theme-text-domain' ),
- 'desc' => '',
- 'pages' => array( 'page' ),
- 'context' => 'normal',
- 'priority' => 'high',
- 'fields' => array(
- array(
- 'label' => __( 'Page Title', 'theme-text-domain' ),
- 'id' => 'pricing_title',
- 'type' => 'text',
- 'desc' => __( 'Set Your Page Title Here', 'theme-text-domain' )
- ),
- array(
- 'label' => __( 'Page Sub Title', 'theme-text-domain' ),
- 'id' => 'pricing_sub_title',
- 'type' => 'text',
- 'desc' => __( 'Set Your Page Sub Title Here', 'theme-text-domain' )
- ),
- array(
- 'label' => __( 'Services Included Title', 'theme-text-domain' ),
- 'id' => 'include_title',
- 'type' => 'text',
- 'desc' => __( 'Set Your services inlcuded Title Here', 'theme-text-domain' )
- ),
- array(
- 'label' => __( 'Services Included Sub Title', 'theme-text-domain' ),
- 'id' => 'include_sub_title',
- 'type' => 'text',
- 'desc' => __( 'Set Your services inlcuded Sub Title Here', 'theme-text-domain' )
- )
- )
- );
- /**
- * Register our meta boxes using the
- * ot_register_meta_box() function.
- */
- $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
- $template_file = get_post_meta($post_id, '_wp_page_template',TRUE);
- if ($template_file == 'pricing.php') {
- ot_register_meta_box( $pricing_page_meta_box );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement