Forked from cobaltapps/freelancer-enqueue-custom-google-fonts.php
Created
March 7, 2019 02:10
-
-
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.
This file contains hidden or 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
| 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