Archived topic
Add google font “Inter”
11 replies · Started by Elia on June 18, 2020
Hi there, the “Inter” google font is missing in your theme. Could you please fix this?
Hi there,
GP only displays the top 200 google fonts to keep the customizer running smoothly. You can selectively add fonts using the snippet provided here:
Thanks a lot, David!
I'm adding this code and I don't see the font in the list:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'inter' ] = array(
'name' => 'inter',
'variants' => array( '400', '700' ),
'category' => 'serif'
);
return $fonts;}
Am I missing something?
Try this:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'Inter' ] = array(
'name' => 'Inter',
'category' => 'serif'
);
return $fonts;
}
There are no varients as such with Inter as its a fancy variable font.
Thanks a lot, David!
You're welcome.
Hi!
I've just tried to use this as a template for adding Carrois Gothic SC but it's not showing up in my list.
As I've no idea what I'm doing with CSS I just added what I thought might work to the current CSS in my child theme, so the whole thing looks like this now:
.site-branding {
display: inline-block;
vertical-align: middle;
}
.site-logo {
float: right;
}
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'Carrois Gothic SC' ] = array(
'name' => 'Carrois Gothic SC',
'category' => 'sans-serif'
);
return $fonts;
}
Hi there,
that code is not CSS - its PHP. This article explains how to add it to a site:
https://docs.generatepress.com/article/adding-php/
Please note - if you're using the new Dynamic Typography option ( see here ) its not required. If that leaves you a little lost then raise a new topic and we can take a look.
Thanks David!
I'm totally lost!
I'll start a new topic.
We'll look out for it :)
Hi David,
Is this still the way to do this (as Inter still does not show up in my list of Google fonts under Customize > Typography)?
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'Inter' ] = array(
'name' => 'Inter',
'category' => 'serif'
);
return $fonts;
}
Thanks,
Alex
Hi there,
if you switch to Dynamic Typography then that will have the Inter font listed:
https://docs.generatepress.com/article/switching-to-dynamic-typography/