Skip to content

Instantly share code, notes, and snippets.

@cobaltapps
Last active March 7, 2019 02:11
Show Gist options
  • Save cobaltapps/9fe6c9672de78be1f6b8ba29288d8cdb to your computer and use it in GitHub Desktop.
Save cobaltapps/9fe6c9672de78be1f6b8ba29288d8cdb to your computer and use it in GitHub Desktop.
A Freelancer helper function that simplifies the process of enqueueing 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