Support Forum
Support › MB Settings Page › Adding Customizer Options to Page Builder FrameworkResolved
Hey there!
I'm hoping to add customizer settings pages to the theme Page Builder Framework. Here is what I have so far.
add_filter( 'mb_settings_pages', function ( $settings_pages ) {
$settings_pages[] = array(
'id' => 'fmstyling',
'option_name' => 'theme_mods_page-builder-framework-child',
'menu_title' => 'General Styling',
'parent' => 'themes.php',
'customizer' => true, // THIS
);
return $settings_pages;
} );
I copied this from your documentation page and changed out theme_mods_justread with my theme's slug. I'm still unclear what the 'parent' is? I don't really know why that's there or what it's accomplishing?
At any rate, I'm not seeing this populate anywhere?
Hi Mark,
The parent
param is used to specify the parent menu in the WP admin area. Setting it to themes.php
make the settings page appear under "Appearance" menu.
In case of using Page Builder Framework theme, this theme doesn't have any admin settings page. All of its settings are in the Customizer. So you need to create sections and set the panel
attribute to the PBF's panel's ID.
For example, the code below will create a new section in the Customize -> Blog panel:
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'my-custom-section',
'title' => 'Custom Section',
'panel' => 'blog_panel', // THIS
'fields' => array(
array(
'name' => 'Logo',
'id' => 'logo',
'type' => 'file_input',
),
array(
'name' => 'Layout',
'id' => 'layout',
'type' => 'image_select',
'options' => array(
'sidebar-left' => 'http://i.imgur.com/Y2sxQ2R.png',
'sidebar-right' => 'http://i.imgur.com/h7ONxhz.png',
'no-sidebar' => 'http://i.imgur.com/m7oQKvk.png',
),
),
),
);
return $meta_boxes;
} );
And here is the result:
https://i.imgur.com/D7WWhYZ.png
You can change the panel
parameter to put the section under other panels. Here is how to find the panel IDs:
Ok, I see this. Second question along the same lines.
I'm going to be using Page Builder Framework premium, which adds a plugin that has premium features for the theme. Would I still need to accomplish this the same way or would I be able to use the themes.php thing then to create my own panel.
Secondly, the way you did it has it adding sub panels. Is it possible to add my own panel the same way as a settings page? Basically like Styles > Theme Colors, Button Colors, Etc as secondary panels?
That did it.
Once I added the Premium plugin and added a few fields to that settings page it worked as expected. 🙂
Hi Mark,
Glad you see it works.
Regarding the 2nd issue about creating your own panel, it's totally possible. Just create a settings page as usual, then add these params to the settings page array:
'customizer' => true,
'customizer_only' => true
And you'll have your own panel. I have written this in the docs, please take a look.