Unyson
Unyson copied to clipboard
How can I load Google Fonts in the header which users have selected?
I've expanded some options for nivo-slider where users could be choosing Google fonts. But the problem is how can I load Google Fonts in the header which users have selected?
You can create a function for that: `if(!function_exists('_action_theme_process_google_fonts')) { function _action_theme_process_google_fonts() { $include_from_google = array(); $google_fonts = fw_get_google_fonts();
$your_typography_option_1 = fw_get_db_settings_option('your_typography_option_1');
$your_typography_option_2 = fw_get_db_settings_option('your_typography_option_2');
// if is google font
if( isset($google_fonts[$your_typography_option_1['family']]) ){
$include_from_google[$your_typography_option_1['family']] = $google_fonts[$your_typography_option_1['family']];
}
if( isset($google_fonts[$your_typography_option_1['family']]) ){
$include_from_google[$your_typography_option_2['family']] = $google_fonts[$your_typography_option_2['family']];
}
$google_fonts_links = fw_theme_get_remote_fonts($include_from_google);
// set a option in db for save google fonts link
update_option( 'fw_theme_google_fonts_link', $google_fonts_links );
}
add_action('fw_settings_form_saved', '_action_theme_process_google_fonts', 999, 2);
}`
You can refer it here https://github.com/ThemeFuse/Unyson/issues/433
Please read here: #2384