Jump to content
Search Community

GSAP on my Wordpress site with picky theme.

Johnnie123 test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

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.
×
×
  • Create New...