Archived topic
Adding additional google fonts to the customizer
7 replies · Started by mavrocreative on May 28, 2019
Hi there!
What's the easiest/best way to add a google font to the customizer if it's not already listed?
Thanks!
Donna
Hi there,
You would need to add one of the PHP function filters listed here:
https://docs.generatepress.com/article/customizing-the-google-font-list/
Thank you so much! Where do I find the information to include such as the variants and array?
Donna
HI Leo, thank you!
Sorry for the confusion! I know how to add PHP; I wanted to know where do I find the Google Font values for variants, etc. as seen in this example:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'david_libre' ] = array(
'name' => 'David Libre',
'variants' => array( '400', '500', '700' ),
'category' => 'serif'
);
Donna
return $fonts;
}
Ahh sorry for the misunderstanding.
You can find what's available through Google. For example:
https://fonts.google.com/specimen/David+Libre
Then I believe 400 is regular, 500 is medium and 700 is bold:
https://docs.generatepress.com/article/google-font-variants/
Let me know if this helps :)
Thank you so much!
No problem :)
