How do I add Typekit Script to Wordpress?

729 Views Asked by At

Is it possible to add the the typekit embed code to wordpress by using wp_enqueue_script()?

Here is what I have so far but I'm not seeing any results:

    function typekit_enqueue_script() {
    wp_enqueue_script(
    'typekit',
    '//use.typekit.net/weq7wou.js',
    array(),
    null,
    true
    );
    }

    add_action( 'wp_enqueue_script', 'typekit_enqueue_script' );
2

There are 2 best solutions below

0
On

Are you loading Typekit afterwards?

function load_typekit() {
echo '<script>try{Typekit.load();}catch(e){}</script>';
}

add_action( 'wp_head', 'load_typekit', 300 );

Or just add the load script in one of your js:

try{Typekit.load();}catch(e){}
0
On

This should work:

wp_enqueue_script( 'typekit','//use.typekit.net/weq7wou.js',array() );