WordPress.org

Ready to get started?Download WordPress

Forums

two jquerys loading...one from disqus (3 posts)

  1. cpkid2
    Member
    Posted 3 years ago #

    I recently installed Disqus and noticed that it loads WordPress' jQuery. I already have jQuery loading from Google so I'd like to take off Disqus' version. Anyone know how? Also, anyone know how to disable Disqus styles and scripts for all pages except single pages?

  2. cpkid2
    Member
    Posted 3 years ago #

    Figured out how to do the first part.

    Just add this to your theme's functions file.

    wp_deregister_script('jquery');

    Anyone have any idea how to disable Disqus styles and scripts for all pages except single pages?

    Something like this? (doesn't work, though)

    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
    
    function my_deregister_styles()
         if (!is_single) {
    	     wp_deregister_style( 'disqus' );
         }
    }
    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
    
    function my_deregister_javascript()
         if (!is_single) {
    	    wp_deregister_script( 'disqus' );
         }
    }
  3. cpkid2
    Member
    Posted 3 years ago #

    Nevermind, adding the following takes jQuery away from the dashboard as well.

    wp_deregister_script('jquery');

    Add this to your theme's functions.php instead:

    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js');

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags