Last active
April 17, 2019 17:18
-
-
Save carasmo/18e1dbb9d44b3f3f4b73c096a04bb37c to your computer and use it in GitHub Desktop.
How to add only the theme font choices and remove the Google fonts from Beaver Builder. See the image in the comment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//don't add again | |
// Save Time? Consider a donation via PayPal @ me@christinacreativedesign.com | |
add_action( 'wp_head', 'childprefix_beaver_builder_modifications', 0 ); | |
/* | |
* Beaver Builder Builder Enabled Modifications | |
* Apply childprefix_replace_system_fonts_with_theme_fonts(); | |
* Apply childprefix_remove_google_font_optgroup_beaver_builder_interface(); | |
*/ | |
function childprefix_beaver_builder_modifications() { | |
if ( ! class_exists( 'FLBuilder' ) && ! FLBuilderModel::is_builder_enabled() ) return; | |
add_action( 'wp_head', 'childprefix_remove_google_font_optgroup_beaver_builder_interface' ); | |
add_filter( 'fl_builder_font_families_system', 'childprefix_replace_system_fonts_with_theme_fonts', 10, 3 ); | |
} | |
/* | |
* Remove Google Fonts from Beaver Builder via CSS only | |
*/ | |
function childprefix_remove_google_font_optgroup_beaver_builder_interface() { | |
echo '<style>optgroup[label=\'Google\'] {display: none!important;}</style>'; | |
} | |
/* | |
* Replace Beaver Builder System Fonts with Choices from Theme | |
* Ref: http://kb.wpbeaverbuilder.com/article/234-add-web-fonts-to-your-theme-and-page-builder | |
*/ | |
function childprefix_replace_system_fonts_with_theme_fonts() { | |
$body[ 'Unna' ] = array( | |
'fallback' => 'sans-serif', | |
'weights' => array( | |
'400', | |
'700' | |
), | |
); | |
$script[ 'Kaushan Script' ] = array( | |
'fallback' => 'sans-serif', | |
'weights' => array( | |
'400', | |
), | |
); | |
return array_merge( $body, $script ); | |
} |
Author
carasmo
commented
Jan 7, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment