Skip to content

Instantly share code, notes, and snippets.

@purzlbaum
Last active December 21, 2015 06:48
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 purzlbaum/6266422 to your computer and use it in GitHub Desktop.
Save purzlbaum/6266422 to your computer and use it in GitHub Desktop.
Adding google fonts only if not on a .loc/.local domain
/**
* Adding google fonts only if not on a .loc/.local domain
*
* This is the proper code to add google fonts
* as seen in TwentyTwelve
* Code partially from: https://github.com/wearerequired/required-foundation
*/
if(strpos(!$_SERVER['SERVER_NAME'], '.loc')){
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array( 'family' => 'Gentium+Book+Basic:400,400italic,700|Open+Sans' );
wp_enqueue_style(
'open-sans',
add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ),
array(),
null
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment