Skip to content

Instantly share code, notes, and snippets.

@FernE97
Last active April 20, 2019 01:46
Show Gist options
  • Save FernE97/5581174 to your computer and use it in GitHub Desktop.
Save FernE97/5581174 to your computer and use it in GitHub Desktop.
PHP: WordPress Typekit wp_enqueue
<?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