zartgesotten
8/3/2017 - 10:00 AM

Add custom fonts to font list in Beaver Builder Customizer ACHTUNG: font has to be added to style.css via @import before

Add custom fonts to font list in Beaver Builder Customizer ACHTUNG: font has to be added to style.css via @import before

<?php
/*Add custom fonts to BB Theme font list*/
add_action( 'init', 'customize_font_list' );
function customize_font_list(){
 
    $custom_fonts = array(
        'opzOswald-Regular' => array(
            'fallback' => 'Arial, sans-serif',
            'weights' => array(
                '400',
                '700',
				'100'
            )
        ),
		 'opzOswald-Light' => array(
            'fallback' => 'Arial, sans-serif',
            'weights' => array(
                '400',
                '700',
				'100'
            )
        )
    );
 
    foreach($custom_fonts as $name => $settings){
        // Add to Theme Customizer
        if(class_exists('FLFontFamilies') && isset(FLFontFamilies::$system)){
            FLFontFamilies::$system[$name] = $settings;
        }
 
        // Add to Page Builder
        if(class_exists('FLBuilderFontFamilies') && isset(FLBuilderFontFamilies::$system)){
            FLBuilderFontFamilies::$system[$name] = $settings;
        }
    }
}
?>