[Resolved] Add google font “Inter”

Home Forums Support [Resolved] Add google font “Inter”

Home Forums Support Add google font “Inter”

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1332361
    Elia

    Hi there, the “Inter” google font is missing in your theme. Could you please fix this?

    https://fonts.google.com/specimen/Inter

    #1332370
    David
    Staff
    Customer Support

    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:

    https://docs.generatepress.com/article/customizing-the-google-font-list/#adding-your-google-font-to-the-list

    #1332391
    Elia

    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?

    #1332420
    David
    Staff
    Customer Support

    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.

    #1332487
    Elia

    Thanks a lot, David!

    #1332603
    David
    Staff
    Customer Support

    You’re welcome.

    #2096026
    teloyrur

    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;
    }
    #2096029
    David
    Staff
    Customer Support

    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.

    #2096078
    teloyrur

    Thanks David!

    I’m totally lost!

    I’ll start a new topic.

    #2096113
    David
    Staff
    Customer Support

    We’ll look out for it 🙂

    #2532611
    Alexander

    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

    #2532725
    David
    Staff
    Customer Support

    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/

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.