Last active
December 23, 2015 00:19
-
-
Save danalmeida/6552518 to your computer and use it in GitHub Desktop.
Wordpress enqueue Typekit scripts directly from your theme
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 | |
/** | |
* TypeKit Fonts | |
* | |
* @since Theme 1.0 | |
*/ | |
function theme_typekit($kit_id) { | |
wp_enqueue_script( 'theme_typekit', "//use.typekit.net/$kit_id.js"); | |
add_action( 'wp_head', 'theme_typekit_inline' ); | |
} | |
function theme_typekit_inline() { | |
if ( wp_script_is( 'theme_typekit', 'done' ) ) { | |
echo '<script type="text/javascript">try{Typekit.load();}catch(e){}</script>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment