Home › Forums › Support › The Fastest Google Fonts – functions.php This topic has 5 replies, 3 voices, and was last updated 3 years, 5 months ago by Tom. Viewing 6 posts - 1 through 6 (of 6 total) Author Posts November 23, 2020 at 5:23 pm #1543282 Julian Is there a way to use this technique for loading google fonts from google cdn in the functions.php? https://css-tricks.com/the-fastest-google-fonts/ November 23, 2020 at 6:03 pm #1543317 ElvinStaff Customer Support Hi, To clarify: do you need these codes added to your site’s <head>? You can do that by either placing these <link> markups on a Hook Element that is hooked to wp_head. https://docs.generatepress.com/article/hooks-element-overview/ or, place this PHP snippet on your child theme’s functions.php. add_action( 'wp_head', function () { ?> // your code here. presumably the <link> ones. <?php } ); November 25, 2020 at 7:09 am #1546440 Julian I was more looking for an “out of the box” solution in form of a functions.php for externally hosted google webfonts. Soemthing that “hooks into” when a google webfont is selected in the customizer. I know how to do it manually. November 25, 2020 at 1:49 pm #1547383 TomLead Developer Lead Developer Hi there, GeneratePress will preconnect Google fonts automatically. It doesn’t preload at the moment – we’ll look into that during our Typography rewrite (scheduled for 3.1.0). November 25, 2020 at 2:42 pm #1547652 Julian Awesome Tom, the workaround which I liked above improves the loading and pagespeed insights as well. Have a look at it ๐ November 26, 2020 at 9:24 am #1550195 TomLead Developer Lead Developer Added that link to our Typography re-write task ๐ Thanks! Author Posts Viewing 6 posts - 1 through 6 (of 6 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In