Skip to content

Snippet: Add new Style options to the Heading element in WPBakery

The following snippet will show you how to add new style options to the Total theme Heading element while using it within the context of the WPBakery plugin. This will not work if trying to add custom styles using the Gutenberg block, because of how Gutenberg works (using javascript instead of PHP for defining settings).

/**
 * Add custom style options to the heading element.
 *
 * @link https://total.wpexplorer.com/docs/snippets/heading-style-options/
 */
add_action( 'vc_after_init', function() {
    $param = WPBMap::getParam( 'vcex_heading', 'style' );
    if ( $param ) {
        $param['value']['My Custom Style 1'] = 'custom-style-1';
        $param['value']['My Custom Style 2'] = 'custom-style-2';
        $param['value']['My Custom Style 3'] = 'custom-style-3';
        vc_update_shortcode_param( 'vcex_heading', $param );
    }
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top