Skip to content

Instantly share code, notes, and snippets.

@humayunahmed8
Created November 29, 2023 19:17
Show Gist options
  • Save humayunahmed8/2a92b7dfe335380038260760ea1cb90b to your computer and use it in GitHub Desktop.
Save humayunahmed8/2a92b7dfe335380038260760ea1cb90b to your computer and use it in GitHub Desktop.
Google fonts Url For WordPress theme
/**
* 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);
}
@humayunahmed8
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment