Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sanabria/296d811383115fb23a7d65b756c43ee0 to your computer and use it in GitHub Desktop.
Save Sanabria/296d811383115fb23a7d65b756c43ee0 to your computer and use it in GitHub Desktop.
WordPress: Add Google Font support to the Sage theme for roots.io
<?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');
<?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