Add a custom theme preset

You can add your own custom presets to the Beaver Builder theme. Any code should go in your child theme functions.php.

Add a preset with the following method. 

FLCustomizer::add_preset( $slug, $args );

Your preset’s slug must be unique; otherwise, it can override other presets. Additionally, this method must be called from within the after_setup_theme action.

An example of a working preset

function my_custom_presets()
    FLCustomizer::add_preset( 'my-preset', array(
        'name'      => 'My Preset',
        'skin'      => 'PATH_TO_CHILD_THEME/my-preset.css',
        'settings'  => array(
            'fl-accent' => '#95bf48'

add_action( 'after_setup_theme', 'my_custom_presets', 11 );

This example creates a preset that changes the default accent color. After you add this code, the custom preset name appears in Customize > Presets and your custom default accent color appears in Customize > General > Accent color.

Here’s a breakdown of each parameter in the add_preset args array.

name (string) (required)

The name of your preset that will be shown in the Customizer > Presets select.

skin (string) (optional)

The skin parameter, which should be set to the system path of a CSS file that will be loaded alongside your preset.

settings (array) (required)

The settings parameter, which is an array of key/value pairs that correlate to the key for a Customizer setting and the value you would like to define for this preset. For example, if you wanted to set the body background color for your preset to white, add the following to your settings array:

	'fl-body-bg' => '#ffffff'

You can access the lists of key/value pairs in the next section.

Key/value pairs for Customizer options

Each Customizer section's options are broken down below to help you create your own presets. They are presented as key/value pairs that you use as args in the settings (array) parameter.

  • For any numbers, do not specify a unit. For any hex colors, include the pound sign/hashtag in front (#).
  • Not all sections in the Customizer are included in these lists, either because the there are no options (such as the Code areas) or because they are duplications of WordPress areas such as widgets and menus.