Support » Plugin: WordPress Slider Block Gutenslider » Already loading slick slider

  • Resolved linds

    (@lsterling03)


    Hi, I’m already enqueuing slick slider (via cdn) on site as we use it on our homepage. I installed your plugin so we can add slick sliders in gutenberg. However, now I’m loading two versions of the slick js/css files. Is there a way to make your plugin unload its slick files, since I’ve already loaded them?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor WordPress Slider

    (@wordpressslider)

    Hey @linds,

    it should be possible but it is not tested, any theme can dequeue scripts and styles. This piece of code is from here, you could add it to your functions.php file.

    //Dequeue Styles
    function project_dequeue_unnecessary_styles() {
        wp_dequeue_style( 'eedee-gutenslider-slick-css' );
        wp_deregister_style( 'eedee-gutenslider-slick-css' );
        wp_dequeue_style( 'eedee-gutenslider-slick-theme-css' );
        wp_deregister_style( 'eedee-gutenslider-slick-theme-css' );
    }
    add_action( 'wp_print_styles', 'project_dequeue_unnecessary_styles' );
    
    //Dequeue JavaScripts
    function project_dequeue_unnecessary_scripts() {
        wp_dequeue_script( 'eedee-gutenslider-slick-js' );
        wp_deregister_script( 'eedee-gutenslider-slick-js' );
    }
    add_action( 'wp_print_scripts', 'project_dequeue_unnecessary_scripts' );

    This is not tested. Please verify that it works.

    linds

    (@lsterling03)

    Thank you. This worked for me.

    • This reply was modified 7 months, 4 weeks ago by linds.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Already loading slick slider’ is closed to new replies.