Skip to content

Snippet: Add Extra Google Font Options

Important: You can now register your own fonts right via the WP admin via the exclusive Total theme Font Manager.

The following snippet can be used to add custom Google Font Family options to or completely override the font family options for any Total theme element that has Google font options. This is useful if you have loaded a custom font via a child theme or 3rd party plugin and want it selectable when editing Total elements via WPBakery.

/**
 * Add extra Google font options.
 *
 * @link https://total.wpexplorer.com/docs/snippets/add-fonts-vc-heading-module/
 */
add_filter( 'vcex_google_fonts_array', function( $array ) {
    $array['My Custom Font Name'] = 'My Custom Font Name';
    return $array;
} );

/**
 * Override the Total elements Google font options.
 *
 * @link https://total.wpexplorer.com/docs/snippets/add-fonts-vc-heading-module/
 */
add_filter( 'vcex_google_fonts_array', function() {
    return array(
        'My Custom Font Name 1' => 'My Custom Font Name 1',
        'My Custom Font Name 2' => 'My Custom Font Name 2',
        'My Custom Font Name 3' => 'My Custom Font Name 3',
    );
} );
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