Created
April 8, 2017 19:10
-
-
Save tammalee/810269033ad22d86ba420dbfa00bc929 to your computer and use it in GitHub Desktop.
[WP] Enqueue Typekit Fonts
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 | |
/** | |
* Enqueue Typekit | |
* Original source: https://wptheming.com/2013/02/typekit-code-snippet/ | |
* @return [type] [description] | |
*/ | |
function kp_scripts() { | |
wp_enqueue_script( 'kp-typekit', '//use.typekit.net/<YOUR CODE HERE>.js', array('jquery'), '201610122', false ); | |
} | |
add_action( 'wp_enqueue_scripts', 'kp_scripts' ); | |
/** | |
* TypeKit Font inline code | |
*/ | |
function kp_typekit_inline() { | |
if ( wp_script_is( 'kp-typekit', 'done' ) ) { ?> | |
<script type="text/javascript">try{Typekit.load();}catch(e){}</script> | |
<?php } | |
} | |
add_action( 'wp_head', 'kp_typekit_inline' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment