Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Johnnie123

GSAP on my Wordpress site with picky theme.

Recommended Posts

I am trying to use Morph and split text on a wordpress site that uses a picky theme.  How would I get GSAP working on my wordpress site?  Thank you!

 

-John

Link to comment
Share on other sites

If you are developing a WordPress theme or customizing a WordPress theme, you can add your JS file within your WordPress functions.php file

<?php
// The proper way to enqueue GSAP script
// wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
function theme_gsap_script() {
    wp_enqueue_script( 'gsap-js', 'http://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.5/TweenMax.min.js', array(), false, true );
    wp_enqueue_script( 'gsap-js', 'http://PATH_TO_MORPHSVGPLUGIN_JS_URL/MorphSVGPlugin.min.js', array(), false, true );    
}
add_action( 'wp_enqueue_scripts', 'theme_gsap_script' );
?>

The last parameter shows true which means WordPress will add the JS file to the footer instead of in the head,

 

You will have to add the right MorphSVGPlugin external link if you have a Club GreenSock membership

 

Here is the link for more information on enqueuing JS files in WordPress:

 

http://codex.wordpress.org/Function_Reference/wp_enqueue_script

 

Hope this helps! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×