Site logo

Archived topic

Not a issue about google fonts

8 replies · Started by Longinos on June 24, 2019

Viewing posts 1–9 of 9

Hi Tom and team
I'm going to post this just to warn. if you did not know, a new functionality of google fonts: You can indicate the font-display attribute in the url. For example:
https://fonts.googleapis.com/css?family=Open+Sans&display=swap
This generates the css w/ font-display:swap

Cheers

Hi there,

You can implement this in GP using this filter:

add_filter( 'generate_google_font_display', function() {
    return 'swap';
} );

Let me know if you have any other questions :)

Hi Tom:
WHERE do you PUT this filter??? In the Website
Thanks
Howard

Hi Tom:
Added the above code to snippets succesfully. However, still get that notice from page speed insights:

Leverage the font-display CSS feature to ensure text is user-visible while webfonts are loading. Learn more.
????
Howard

However—- (???) I just did a MOBILE page speed insights test:
100 💯 mobile
💯 desktop

How do you figure it??
Howard

Hi there,

maybe the site was cached on your server ? And it took a while to clear.

Thanks- great support and best WP theme!!

Glad to be of help !

This archived topic is closed to new replies.