jerryB Posted September 15, 2021 Share Posted September 15, 2021 Hi, I downloaded the member source files and have them in my theme's directory; I'm trying to enqueue to GSAP and ScrollTrigger, but not sure of the exact coding or which files in the folder I need to connect to; this is what I have, but it's not working ... thanks <?php function add_gsap_scripts() { wp_enqueue_script ( 'gsap-js' , get_stylesheet_directory_uri() . '/lib/gsap/minified/gsap.min.js', array( 'jquery' ), '1', true ); wp_enqueue_style ( 'gsap-ScrollTrigger' , get_stylesheet_directory_uri() . '/lib/gsap/minified/ScrollTrigger.min.js', '', '1', 'all' ); wp_enqueue_script( 'gsap-custom', get_template_directory_uri() . '/js/custom-gsap-scripts.js', array(), false, true ); } add_action( 'wp_enqueue_scripts', 'add_gsap_scripts' ); ?> Link to comment Share on other sites More sharing options...
Cassie Posted September 15, 2021 Share Posted September 15, 2021 Hi there JerryB, I'm afraid my wordpress knowledge is a little shaky but this thread may be of use - 1 Link to comment Share on other sites More sharing options...
OSUblake Posted September 15, 2021 Share Posted September 15, 2021 Hi Jerry! I'm not familiar with WordPress. Maybe this thread will be of help? If not, try searching the forums for enqueue as it's been brought up many times before. 1 Link to comment Share on other sites More sharing options...
jerryB Posted September 15, 2021 Author Share Posted September 15, 2021 Thanks, yeah, I did see those, but they are using the CDN--I can get that to work--but I need to enqueue to the local file. Was hoping to find an example of that from a user. Thanks Link to comment Share on other sites More sharing options...
OSUblake Posted September 15, 2021 Share Posted September 15, 2021 It doesn't look they are using CDNs for every file. Here's another one. Or maybe try asking how to load scripts through a WordPress support channel. Link to comment Share on other sites More sharing options...
jerryB Posted September 15, 2021 Author Share Posted September 15, 2021 Ah, thanks, that looks closer; I'll play with that config 1 Link to comment Share on other sites More sharing options...
TheWebSerf Posted September 19, 2021 Share Posted September 19, 2021 Hey Jerry, It looks like you enqueue gsap from a child theme and then enqueue your custom-gsap-scripts.js from the parent theme. If all the scripts are in the child theme you need to use: get_stylesheet_directory_uri(). If you do not have a child theme and are modifying or building a custom theme use: get_template_directory_uri(). Check the console and make sure they are loading and you are not getting 404 errors. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now