[Resolved] Missing Google Fonts from Font selector

Home Forums Support [Resolved] Missing Google Fonts from Font selector

Home Forums Support Missing Google Fonts from Font selector

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1583982
    Morten

    Hi!

    First of all, I’ve searched the forum for solutions to this issue and I found the following support topic:

    https://docs.generatepress.com/article/customizing-the-google-font-list/

    Unfortunately this doesnt seem to work for my installation of GeneratePress. I’ve added the
    specified code to my child theme, but it doesnt seem to change anything in the theme font selector.

    #1583993
    Elvin
    Staff
    Customer Support

    Hi Martin,

    Since the documentation is pretty dated, I’ve actually tested this snippet included on the docs to check and make sure.

    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'
    	);
    
    	return $fonts;
    }

    And it actually still works as shown here: https://share.getcloudapp.com/llun66Nj

    Note: I’m using Code Snippets plugin but adding this to the Child Theme’s functions.php should do the same thing.

    Can you recheck the snippet if there’s no missing syntax? Let us know.

    You can link us to the site you’re working on if you’d like. You can provide the site details on the private information text field.

    A wise man once said:
    "Have you cleared your cache?"

    #1584000
    Morten

    I think I’ve found the issue. The snippet to add all the Google Fonts doesn’t work, but I got the snippet you just posted working for the one font I actually needed.

    Here’s the added code that worked for anyone interested:

    add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
    function tu_add_google_fonts( $fonts ) {
    	$fonts[ 'mulish' ] = array( 
    		'name' => 'Mulish',
    		'variants' => array( '400', '500', '700' ),
    		'category' => 'sans-serif'
    	);
    
    	return $fonts;
    }
    #1584013
    Elvin
    Staff
    Customer Support

    I think I’ve found the issue. The snippet to add all the Google Fonts doesn’t work, but I got the snippet you just posted working for the one font I actually needed.

    Nice one! Good catch. 😀

    Glad you were able to make it work. 🙂

    A wise man once said:
    "Have you cleared your cache?"

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