Meta Box Not Showing Up
Support › MB Include Exclude › Meta Box Not Showing Up
- This topic has 2 replies, 2 voices, and was last updated 9 years, 6 months ago by
tone4407.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
October 21, 2015 at 4:18 AM #1595
tone4407
ParticipantForgive me, I'm a newb.
I have the Meta Box plugin and just purchased the Include/Exclude plugin so I can show the custom meta boxes on the home page only.
Here is my code:
<?php add_filter( 'rwmb_meta_boxes', 'meta_box_include_exclude_demo_register' ); /** * Register meta boxes * * @param array $meta_boxes * * @return array */ function meta_box_include_exclude_demo_register( $meta_boxes ) { // 1st meta box $meta_boxes[] = array( // Meta box id, UNIQUE per meta box. Optional since 4.1.5 'id' => 'meta-decoy-101', // Meta box title - Will appear at the drag and drop handle bar. Required. 'title' => __( 'Decoy 101', 'meta-decoy-101' ), // Where the meta box appear: normal (default), advanced, side. Optional. 'context' => 'normal', // Order of meta box: high (default), low. Optional. 'priority' => 'high', // Auto save: true, false (default). Optional. 'autosave' => true, // Register this meta box for posts matched below conditions 'include' => array( // List of page templates. Can be array or comma separated. Optional. 'template' => array( 'page-home.php' ), ), // List of meta fields 'fields' => array( /// WYSIWYG/RICH TEXT EDITOR array( // 'name' => __( 'WYSIWYG / Rich Text Editor', 'your-prefix' ), 'id' => "meta-decoy-101-content", 'type' => 'wysiwyg', // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save 'raw' => false, // Editor settings, see wp_editor() function: look4wp.com/wp_editor 'options' => array( 'textarea_rows' => 10, 'teeny' => true, 'media_buttons' => false, ), ), ), ); return $meta_boxes; } /** * Manual check for including meta box * You can check ANY conditions here * * @param $meta_box * * @return bool */ function manual_include( $meta_box ) { if ( $meta_box['title'] == 'Include Meta Box' ) return true; return false; }
It's not showing up when I go to Edit Page for the Home Page. The home page is set to use the page-home.php template.
October 22, 2015 at 8:24 AM #1601Anh Tran
KeymasterHi,
I don't see
post_types
parameter for the meta box. Please add this:'post_types' => 'page', 'fields' => ... // Your fields here
For more info about
post_types
, please check here.October 23, 2015 at 6:11 AM #1604tone4407
ParticipantThat did the trick. Thanks, Anh!
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- The topic ‘Meta Box Not Showing Up’ is closed to new replies.