• Hello,

    I am improving my content helped with this great plugin.

    I am wondering how to deregister a script used by a shortcode because i use this script yet for others parts of the site.

    For example, i use swiper to animate some parts of my page. The problem is when i add a carousel with shortcodes ultimate it loads for a second time swiper.js. As i always use swiper on my page i whould like to remove the second one loaded by the plugin.

    What is the best way to achieve it?

    Thank in advance for any help,
    JB

    https://www.ads-software.com/plugins/shortcodes-ultimate/

Viewing 1 replies (of 1 total)
  • Thread Starter soapoperator

    (@soapoperator)

    Hello,

    I have try some methode but i don’t understand how the js is loaded into the plugin (even if i check inc\core\assets.php).

    Following here the script i use:

    function suc_script_update() {
    		$handle = 'my-swiper';
    		$list = 'enqueued'; // registered, enqueued, done, to_do
    		if (wp_script_is( $handle, $list )) {
    			wp_deregister_script( 'swiper' ); // su name
    		};
    	}
    	add_action('wp_enqueue_scripts', 'suc_script_update');

    This code works with my template js code but it doesn’t work with the plugin code.

    Any help will be appreciated.
    Thanks,
    JB

Viewing 1 replies (of 1 total)
  • The topic ‘De-register JS which is added twice because of template.’ is closed to new replies.