Skip to content

Commit

Permalink
Update google-fonts.php
Browse files Browse the repository at this point in the history
  • Loading branch information
jessuppi authored Nov 7, 2024
1 parent c17e3cb commit d31d6c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inc/google-fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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' );
Expand Down

0 comments on commit d31d6c2

Please sign in to comment.