WordPress.org

Ready to get started?Download WordPress

Forums

Shortcodes Ultimate
De-register JS which is added twice because of template. (2 posts)

  1. soapoperator
    Member
    Posted 6 months ago #

    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

    http://wordpress.org/plugins/shortcodes-ultimate/

  2. soapoperator
    Member
    Posted 6 months ago #

    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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags