Output google fonts links in head

This commit is contained in:
Tetrakern 2024-02-08 16:03:35 +01:00
parent 1728fd56fc
commit f8da09fdec

View File

@ -1110,6 +1110,21 @@ function fictioneer_output_head_fonts() {
<noscript><link rel="stylesheet" href="<?php echo $full_fonts_href; ?>"></noscript>
<?php // <--- End HTML
}
// Output Google Fonts links (if any)
$google_fonts_links = get_option( 'fictioneer_google_fonts_links' );
$google_fonts_links = explode( "\n", $google_fonts_links );
if ( ! empty( $google_fonts_links ) ) {
// Start HTML ---> ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<?php // <--- End HTML
foreach ( $google_fonts_links as $link ) {
printf( '<link href="%s" rel="stylesheet">', $link );
}
}
}
add_action( 'wp_head', 'fictioneer_output_head_fonts', 5 );