Site icon WP Beaches

Change Default Values in Beaver Builder Themes Customizer Settings

Change Default Customizer Settings Beaver Builder

The Beaver Builder Themes default values in the Customizer can be changed with the fl_theme_add_panel_data filter. These are the values when you click on the default button that return a value set from the original code.

The filter is found bb-theme/classes/class-fl-customizer.php and takes 2 parameters $key and $data, the former being the customizer panel and the latter the actual customizer settings.

The $key(s) are …

So the filter is expressed like so…

add_filter('fl_theme_add_panel_data','bt_customizer_options_filtered', 10, 2 ); 
/**
 *  Filtering the Customizer
 *  Not working for theme if inside after_setup_theme function
 *  Changing the defaults on the live preset.
 *  @since 2.0.0
 */
function bt_customizer_options_filtered( $data, $key ) {
    if ( 'fl-general' == $key ) {
        // Do something with the $data.

        // Layout
        $data['sections']['fl-layout']['options']['fl-content-width']['setting']['default']='1200';
        $data['sections']['fl-layout']['options']['fl-scroll-to-top']['setting']['default']='enable';
        $data['sections']['fl-layout']['options']['fl-awesome']['setting']['default']='fa5';
        $data['sections']['fl-layout']['options']['fl-framework']['setting']['default']='bootstrap-4';
        // Background
        $data['sections']['fl-body-bg']['options']['fl-body-bg-color']['setting']['default']='#ffffff';
        // Accent Color
        $data['sections']['fl-accent-color']['options']['fl-accent']['setting']['default']='#EB5D50';
        $data['sections']['fl-accent-color']['options']['fl-accent-hover']['setting']['default']='#2C848D';
        // Fonts
        $data['sections']['fl-heading-font']['options']['fl-title-font-family']['setting']['default']='system-ui';
        $data['sections']['fl-heading-font']['options']['fl-heading-font-family']['setting']['default']='system-ui';
        $data['sections']['fl-body-font']['options']['fl-body-text-color']['setting']['default']='#333333';
        $data['sections']['fl-body-font']['options']['fl-body-font-family']['setting']['default']='system-ui';
        $data['sections']['fl-body-font']['options']['fl-body-font-size']['setting']['default']='18';

    if ( 'fl-header' == $key ) {

        $data['sections']['fl-header-logo']['options']['fl-logo-font-family']['setting']['default']='system-ui';
        $data['sections']['fl-nav-style']['options']['fl-nav-font-family']['setting']['default']='system-ui';
        $data['sections']['fl-nav-style']['options']['fl-nav-hover-color']['setting']['default']='#999999';

    }
 
    return $data;  
 }
}

The nested arrays are cascaded until the default setting which is then assigned the new default value.

Above both the fl-general and fl-header are targetted with if statements and various default values set.

You can view the structure of various nested arrays in the normal array presentation in the bb-theme/includes directory such as bb/theme/includes/customizer-panel-general.php file.

 

ref

Exit mobile version