Support » Developing with WordPress » how to add gsap animations to WordPress

  • 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="" defer></script>
      <script src="" 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', '', array(), $in_footer = true )
      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,


Viewing 1 replies (of 1 total)
  • You’re using the wrong code.

    here is the clean code.

     * Enqueue gsap scripts.
    function custom_add_gsap_scripts() {
    	wp_enqueue_script( 'custom-gsap', '', array(), '3.9.1', true );
    add_action( 'wp_enqueue_scripts', 'custom_add_gsap_scripts' );
Viewing 1 replies (of 1 total)
  • The topic ‘how to add gsap animations to WordPress’ is closed to new replies.