Archived topic
Problem adding a google font
1 reply · Started by g_younes on August 23, 2019
I followed all topics in here, added this code to code snippets:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'Didact Gothic' ] = array(
'name' => 'Didact Gothic',
'variants' => array( '400', '500', '700' ),
'category' => 'serif'
);
return $fonts;
}
And this to the css:
body{
font-family: 'Didact Gothic', sans-serif;
}
This was working without a problem when I had 'Roboto' instead of 'Didact Gothic' but there seems to be a particular problem with Didact Gothic, because it is falling back to sans-serif. If you could help me sort this out it would be great.
Hi there,
Copy and paste this instead:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'didact_gothic' ] = array(
'name' => 'Didact Gothic',
'variants' => array( '400', '500', '700' ),
'category' => 'serif'
);
return $fonts;
}
The font should show up in the customizer under Typography > Body.
Let me know if this helps :)