Created
November 29, 2023 19:17
-
-
Save humayunahmed8/2a92b7dfe335380038260760ea1cb90b to your computer and use it in GitHub Desktop.
Google fonts Url For WordPress theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Google fonts url. Use in function.php file and call with wp_enqueue_style. Exemple | |
* wp_enqueue_style(theme-name-google-fonts', full_pack_google_fonts_url(), array(), null); | |
*/ | |
function full_pack_google_fonts_url() | |
{ | |
$fonts_url = ''; | |
$font_families = array(); | |
$font_families[] = 'Open Sans:400,400i,700,700i,900,900i'; | |
$font_families[] = 'Oswald:300,400,400i,600,700,700i,900,900i'; | |
$query_args = array( | |
'family' => urlencode(implode('|', $font_families)), | |
'subset' => urlencode('latin,latin-ext'), | |
); | |
$fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css'); | |
return esc_url_raw($fonts_url); | |
} |
Author
humayunahmed8
commented
Nov 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment