Last active
April 20, 2019 01:46
-
-
Save FernE97/5581174 to your computer and use it in GitHub Desktop.
PHP: WordPress Typekit wp_enqueue
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 | |
function h5bs_enqueue_scripts() { | |
wp_enqueue_script( 'typekit', '//use.typekit.net/xxxxxxx.js' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'h5bs_enqueue_scripts' ); | |
function h5bs_typekit_inline() { | |
if ( wp_script_is( 'typekit', 'done' ) ) { | |
echo '<script>try{Typekit.load();}catch(e){}</script>'; | |
} | |
} | |
add_action( 'wp_head', 'h5bs_typekit_inline' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment