Archived topic
Adding a non-google font
19 replies · Started by Bob on June 1, 2020
Can you share the PHP snippet you used to add the Fonts to the Customizer ?
ie. this part of the process:
https://docs.generatepress.com/article/adding-local-fonts/#adding-it-to-the-customizer
In the Child theme Functions.php
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'caviardreams';
return $fonts;
} );
So font name used here:
$fonts[] = 'caviardreams';
Must match the font-family added to your @font-face CSS
font-family: 'caviar_dreamsregular',
So replace your function with this:
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'caviar_dreamsregular';
$fonts[] = 'caviar_dreamsitalic';
$fonts[] = 'caviar_dreamsbold';
$fonts[] = 'caviar_dreamsbold_italic';
return $fonts;
} );
Then you should see all 4 of your fonts in the customizer.... and selecting them should now work.
Thanks David,
Funny thing is, I tried that earlier without success. I am guessing there was more than one issue at play.
Anyway, once again you have nailed it. Now I can finally get some sleep.
Many thanks
Glad to hear that. And you're welcome