Support Forum
OK so I generated this metabox which will be included in my theme:
function themename_page_options_metabox( $meta_boxes ) {
$prefix = 'themename_';
$meta_boxes[] = array(
'id' => 'page-options',
'title' => esc_html__('Hide Stuff','themename'),
'post_types' => array('post','page'),
'context' => 'side',
'priority' => 'default',
'autosave' => true,
'fields' => array(
array(
'id' => $prefix . 'hide_stuff',
'name' => esc_html__('Hide This','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
),
);
return $meta_boxes;
}
add_filter('rwmb_meta_boxes','themename_page_options_metabox');
So after they install the theme, they use a plugin that will add more choices. How would I overwrite the filter above to add more choices when the plugin is added and activated, like this:
function themename_page_options_metabox( $meta_boxes ) {
$prefix = 'themename_';
$meta_boxes[] = array(
'id' => 'page-options',
'title' => esc_html__( 'Hide Stuff', 'themename' ),
'post_types' => array( 'post', 'page' ),
'context' => 'side',
'priority' => 'default',
'autosave' => true,
'fields' => array(
array(
'id' => $prefix . 'hide_this',
'name' => esc_html__('Hide This','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
array(
'id' => $prefix . 'hide_that',
'name' => esc_html__('Hide That','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
array(
'id' => $prefix . 'hide_and_the_other',
'name' => esc_html__('Hide This, That and the Other','themename'),
'type' => 'checkbox',
'desc' => esc_html__('This is the description','themename'),
),
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'themename_page_options_metabox' );
Hi Thomas,
I replied you on Github. To edit existing meta boxes, please just follow this instruction.
Yes I saw it on GitHub,
Thank you. I will have a look this weekend, however I am really not sure I understand...lol. I am really new to all of this metabox stuff but I find it very interesting.
I especially like everything your plugin offers and I plan on putting it to good use 😉
Thanks again. I may have some additional questions..lol
No problem :). If you find anything confused or need help, please just post here. I will try my best to explain it the easy way.
Merry Christmas!
Just wanted to let you know that the information you had me read was SPOT ON!!!
After playing around with it, I got it working exactly the way I needed it to. Thank you so much and I appreciate the help. Merry Christmas to you and yours as well and very Happy and Prosperous New Year!
Thanks again 😉