Tagged: google fonts
Hi there,
I realize that this will affect page load, but we need to activate a third google font to the site. Currently I have the heading font set to Oswald and the body text set to Roboto. I need to add Droid Serif to this activated fonts list. I can’t seem to find the right code through other forum posts. Can you please advise?
Thanks!
Hey kristenangel,
You can add the font to the function that you’re using already.
Can you show us the code you’re using?
Did you upload the Droid font already?
Best regards,
Victoria
Droid Serif is already in the dropdown list of fonts available to the theme, so I shouldn’t need to upload a second version, correct?
Regardless, I have this in my functions file:
add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
function avia_add_heading_font($fonts)
{
$fonts['Droid Serif'] = 'Droid Serif:400';
return $fonts;
}
add_filter( 'avf_google_content_font', 'avia_add_content_font');
function avia_add_content_font($fonts)
{
$fonts['Droid Serif'] = 'Droid Serif:400';
return $fonts;
}
And am using !important to the text css to try and override the theme choice fonts, but not having any luck.
Thanks~
Hi,
You have to add the font manually. This article should help.
// https://www.wpbeginner.com/wp-themes/how-add-google-web-fonts-wordpress-themes/
function wpb_add_google_fonts() {
wp_enqueue_style( 'wpb-google-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300', false );
}
add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' );
Best regards,
Ismael
Thank you Ismael, this worked.
Hi kristenangel,
Glad we could help :)
If you need further assistance please let us know.
Best regards,
Victoria