Hello, I am absolutely new to gsap and WordPress. I am trying to build a practice WordPress site and I want to include gsap animations in it, but I really don't know how to do it. I have tried a few things like,
I got the plugin WPcoder and inserted the scripts in the html, and the gsap code in the js sections of the plugin
The insert headers and footers plugin: I added the below 2 lines of code in the Scripts in Header section of the plugin
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.0/gsap.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/ScrollTrigger.min.js" defer></script>
and I even tried to enqueue the scripts in the funtions.php file in my theme(astra) folder. I added the below code in the end of the functions.php file
function wpb_adding_scripts(){
wp_register_script( 'gsap', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js', array(), $in_footer = true )
wp_enqueue_script('gsap');
}
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
and I get an error There has been a critical error on this website . By the way I have no knowledge of php.
Nothing seems to work. Please help me with integrating gsap in WordPress.
Thank you,
Shreeja