Skip to content

Instantly share code, notes, and snippets.

@devinsays
Created April 3, 2017 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save devinsays/fb8bee935967cb673c40e854700a1569 to your computer and use it in GitHub Desktop.
Save devinsays/fb8bee935967cb673c40e854700a1569 to your computer and use it in GitHub Desktop.
Typekit Loading Snippet
/**
* TypeKit Fonts
*
* @since Theme 1.0
*/
function theme_typekit() {
wp_enqueue_script( 'theme_typekit', '//use.typekit.net/xxxxxxx.js');
}
add_action( 'wp_enqueue_scripts', 'theme_typekit' );
function theme_typekit_inline() {
if ( wp_script_is( 'theme_typekit', 'done' ) ) { ?>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<?php }
}
add_action( 'wp_head', 'theme_typekit_inline' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment