From 6fd2bb30ed2d872536cdf5edf572503e0c5c2858 Mon Sep 17 00:00:00 2001 From: ciderpunx Date: Thu, 18 May 2023 18:36:54 +0100 Subject: [PATCH] Add &display=swap to googlefont calls Google fonts will add font-display: swap if you pass a parameter to it. This fixes FOIT in many modern browsers which probably makes the user experience a little better. This PR just adds the display=swap parameter to the two places where the google font URL is used. --- inc/class-storefront.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/class-storefront.php b/inc/class-storefront.php index 31bd5a127..c1efbe2c1 100644 --- a/inc/class-storefront.php +++ b/inc/class-storefront.php @@ -384,7 +384,7 @@ public function google_fonts() { $google_fonts = apply_filters( 'storefront_google_font_families', array( - 'source-sans-pro' => 'Source+Sans+Pro:400,300,300italic,400italic,600,700,900', + 'source-sans-pro' => 'Source+Sans+Pro:400,300,300italic,400italic,600,700,900&display=swap', ) ); @@ -507,7 +507,7 @@ public function navigation_markup_template() { public function print_embed_styles() { global $storefront_version; - wp_enqueue_style( 'source-sans-pro', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,700,900', array(), $storefront_version ); + wp_enqueue_style( 'source-sans-pro', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,700,900&display=swap', array(), $storefront_version ); $accent_color = get_theme_mod( 'storefront_accent_color' ); $background_color = storefront_get_content_background_color(); ?>