Last active
February 11, 2017 11:47
-
-
Save RhythmShahriar/a84be51808ae1d77451b6d01c345a3ad to your computer and use it in GitHub Desktop.
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
| /**------------------------------------------------- | |
| * @package Code Snippets | |
| * @link http://rhythmshahriar.com/codes/ | |
| * @author Rhythm Shahriar <[email protected]> | |
| * @link http://rhythmshahriar.com | |
| * @copyright Copyright © 2017, Rhythm Shahriar | |
| ---------------------------------------------------*/ | |
| #PROPER WAY TO LOAD GOOGLE FONTS IN WORDPRESS | |
| //load the fonts from googleapis | |
| function rhythm_google_fonts_url() { | |
| $font_url = ''; | |
| if ( 'off' !== _x( 'on', 'Google font: on or off', 'rhythm' ) ) { | |
| $font_url = add_query_arg( 'family', urlencode( 'Montserrat:400,700|Sacramento|Merriweather:300,400' ), "//fonts.googleapis.com/css" ); | |
| } | |
| return $font_url; | |
| } | |
| //load google font | |
| add_action( 'wp_enqueue_scripts', 'rhythm_load_google_fonts' ); | |
| function rhythm_load_google_fonts() { | |
| wp_enqueue_style( 'google-fonts', rhythm_google_fonts_url() ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment