From d31d6c2db34b5ba2300ec3d5f40e8ab3346b3541 Mon Sep 17 00:00:00 2001 From: Jesse Nickles Date: Thu, 7 Nov 2024 19:12:24 +0700 Subject: [PATCH] Update google-fonts.php --- inc/google-fonts.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inc/google-fonts.php b/inc/google-fonts.php index c7b960c..84eee01 100644 --- a/inc/google-fonts.php +++ b/inc/google-fonts.php @@ -14,6 +14,10 @@ function hovercraft_google_fonts() { $third_font_family = get_theme_mod( 'hovercraft_third_font_family', 'roboto' ); $third_font_family_final = ucwords( ucfirst( str_replace( '_', '+', $third_font_family ) ), '+' ); + // get and format the multilingual font family for google fonts + $multilingual_font_family = get_theme_mod( 'hovercraft_multilingual_font_family', 'none' ); + $multilingual_font_family_final = ucwords( ucfirst( str_replace( '_', '+', $multilingual_font_family ) ), '+' ); + // specify only the font variations 400, 600, and 700 for both regular and italic styles $font_variations = 'ital,wght@0,400;0,600;0,700;1,400;1,600;1,700'; @@ -33,6 +37,10 @@ function hovercraft_google_fonts() { $google_fonts[] = "family={$third_font_family_final}:$font_variations"; } + if ( ! empty( $multilingual_font_family ) && $multilingual_font_family !== 'none' ) { + $google_fonts[] = "family={$multilingual_font_family_final}:$font_variations"; + } + // enqueue the google fonts stylesheet if any font families are set if ( ! empty( $google_fonts ) ) { $google_fonts_url = esc_url( 'https://fonts.googleapis.com/css2?' . implode( '&', $google_fonts ) . '&display=swap' );