Forked from briankompanee/sage-google-fonts-config.php
Created
April 10, 2020 22:37
-
-
Save Sanabria/296d811383115fb23a7d65b756c43ee0 to your computer and use it in GitHub Desktop.
WordPress: Add Google Font support to the Sage theme for roots.io
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 | |
/** | |
* Add your Google Fonts here. | |
* This is specifically for the theme Sage from roots.io and goes in config.php | |
* Change the font name, weights and styles to what you are using as needed. | |
*/ | |
define('GOOGLE_FONTS', 'Oswald:400,300,700:latin'); |
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 | |
/** | |
* Manage google fonts of load_google_font() | |
* This is specifically for the theme Sage from roots.io and goes in extras.php | |
* set GOOGLE_FONTS constant in config.php | |
*/ | |
function load_google_fonts() { | |
if( ! defined( 'GOOGLE_FONTS' ) ) return; | |
echo '<link href="https://fonts.googleapis.com/css?family=' . GOOGLE_FONTS . '" rel="stylesheet" type="text/css" />'."\n"; | |
} | |
add_action( 'wp_head', __NAMESPACE__ . '\\load_google_fonts' , 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment