Snippets: Add new Style options to the Total 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.
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 );
    }
} );

Snippet Type: PHP

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)