• Hi,
    I added PHP code

    add_filter( 'generate_number_of_fonts','tu_show_all_available_google_fonts' );
    function tu_show_all_available_google_fonts() {
    	return 'all';
    }

    But I want to use Google Fonts (Lato font) when I write article and choose it in the list.
    Is it possible?

    Thank you for support

    Alberto

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    You should be able to add that using a function like this: https://docs.generatepress.com/article/customizing-the-google-font-list/#adding-your-google-font-to-the-list

    Let me know if you need more info 🙂

    Thread Starter albertx7

    (@albertx7)

    I added that 2 code with Code Snippets plugin.
    I replace ‘name’ => ‘Zilla Slab’ with ‘name’ => ‘Lato’,
    I set both snippets in “Run Snippet Everywhere”
    But i can’t see google fonts list in Article section.
    I don’t understand why :-/

    Thank you TOm

    Theme Author Tom

    (@edge22)

    Can you share the exact code snippet you added with me?

    Be sure to highlight it and click the “code” button in the editor.

    Thread Starter albertx7

    (@albertx7)

    Sure.
    In the Snippets plugin, I added:

    add_filter( 'generate_number_of_fonts','tu_show_fifty_google_fonts' );
    function tu_show_fifty_google_fonts() {
    	return 50;
    }

    and then this:

    add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
    function tu_add_google_fonts( $fonts ) {
    	$fonts[ 'zilla_slab' ] = array( 
    		'name' => 'Lato',
    		'variants' => array( '300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
    		'category' => 'serif'
    	);
    	
    	return $fonts;
    }

    Google fonts are available in Customizes section of Generatepress, but they aren’t in the Article section when i try to choose the font.

    Theme Author Tom

    (@edge22)

    Try this instead:

    add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
    function tu_add_google_fonts( $fonts ) {
    	$fonts[ 'lato' ] = array( 
    		'name' => 'Lato',
    		'variants' => array( '300', '300i', '400', '400i', '700', '700i', '900', '900i' ),
    		'category' => 'sans-serif'
    	);
    	
    	return $fonts;
    }
    Thread Starter albertx7

    (@albertx7)

    I tried….but doesn’t works.
    No problem..i write articles with Georgia ;-(

    Thanks Tom

    PS: Where can I learn how to change template for my pages? I want pages look different from article

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Google fonts in Article section’ is closed to new replies.