-
-
Save PittsburghChris/7586814 to your computer and use it in GitHub Desktop.
How to add Google Fonts to an HTML5-compatible Genesis child theme after 2013.
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
<?php | |
//* Do NOT include the opening php tag | |
//* Enqueue Lato Google font | |
add_action( 'wp_enqueue_scripts', 'sp_load_google_fonts', 5); | |
function sp_load_google_fonts() { | |
wp_enqueue_style( 'google-font-lato', '//fonts.googleapis.com/css?family=Lato:300,700', array(), CHILD_THEME_VERSION ); | |
} |
To the StudioPress recommendation: I added the priority "5", as seen in the WPBeginner's demo.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above resource is written up at:
http://my.studiopress.com/tutorials/load-google-fonts/
It is compatible with the Genesis HTML5-ready themes.
This should replace Genesis' old "@import" method. That method is explained at:
http://www.studiopress.com/tips/google-web-fonts.htm
It could also replace WPBeginner's "hook" method, explained at:
http://www.wpbeginner.com/wp-themes/how-add-google-web-fonts-wordpress-themes/
add_action( 'genesis_meta', 'wpb_add_google_fonts', 5);
function wpb_add_google_fonts() {
echo '';
}