Last active
October 28, 2015 11:40
-
-
Save drjecker/8a3829ddde634c1af8e5 to your computer and use it in GitHub Desktop.
WordCamp 2015 Google & Typekit Code
This file contains 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 Google Fonts To Theme | |
// From https://premium.wpmudev.org/blog/custom-google-fonts/ | |
function google_fonts() { | |
$query_args = array( | |
'family' => 'Open+Sans:400,700|Oswald:700' | |
'subset' => 'latin,latin-ext', | |
); | |
wp_register_style( 'google_fonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null ); | |
} | |
add_action('wp_enqueue_scripts', 'google_fonts'); | |
?> | |
<?php | |
// Add Typekit Fonts To Theme | |
// Adapted from http://www.wprecipes.com/how-to-directly-include-typekit-fonts-on-your-wordpress-theme | |
function typekit_fonts() { | |
wp_enqueue_script( 'theme_typekit','//use.typekit.net/xxxxxxx.js'); | |
} | |
add_action( 'wp_enqueue_scripts', 'typekit_fonts' ); | |
function typekit_load() { | |
if ( wp_script_is( 'typekit_fonts', 'done' ) ) { ?> | |
<script type="text/javascript">try{Typekit.load();}catch(e){}</script> | |
<?php } | |
} | |
add_action( 'wp_head', 'typekit_load' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment