Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DalavanCloud/2503cc99c2fde908cb25aea474f6efeb to your computer and use it in GitHub Desktop.
Save DalavanCloud/2503cc99c2fde908cb25aea474f6efeb to your computer and use it in GitHub Desktop.
The following code allows you to enqueue custom Google Fonts through your Child Theme's functions.php file.
add_action( 'wp_enqueue_scripts', 'freelancer_child_enqueue_google_fonts' );
/*
* Enqueue custom google fonts.
*/
function freelancer_child_enqueue_google_fonts() {
/*
* Example of the freelancer_google_fonts_url function
* with multiple Google Fonts and multiple subsets.
* Note that the fonts are required, but subsets are optional
* and only necessary if you're using non-default/custom subset
* (i.e.. something other than "latin").
*
$google_fonts_url = freelancer_google_fonts_url(
// An array of Google fonts with their respective styles.
array(
'Saira Semi Condensed' => '400,700',
'Lato' => '400,400i,700,700i',
),
// An array of Google font subsets associated with the above fonts.
array( 'latin-ext', 'vietnamese' )
);
/* # Custom Google Fonts
* Add Google fonts.
*/
wp_enqueue_style( 'freelancer-child-fonts', $google_fonts_url, array(), FREELANCER_CHILD_THEME_VERSION );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment