• Hi there,

    i´ve put some java scripts into my header section to add new functionalities. The scripts only seem to work if i include jquery.min.js from google like in the tutorial i used (http://ianlunn.co.uk/articles/recreate-nikebetterworld-parallax/).

    Now the jquery.min.js from google seems to conflict with the jquery.js from wordpress, which breaks me plugins like nextgen gallery. The problem seems to be, that i call the script in my header instead of registering correctly.

    So these two topics:
    http://wordpress.org/support/topic/linking-to-jquery-the-right-way?replies=7
    http://wordpress.org/support/topic/double-jquery-complete-mess?replies=11
    (and several other say) that i have to put something like this in my functions.php:

    function add_google_jquery() {
       if ( !is_admin() ) {
          wp_deregister_script('jquery');
          wp_enqueue_script('jquery','http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js',,'1.4.1',true);
       }
    }
    add_action('wp_print_scripts ', 'add_google_jquery');

    That looks totally right and i found several topics that say similar things. But if i put this in the functions.php of my twenty-twelve child-theme, or even in twenty-twelve itself, nothing happpens.

    Neither the first is stops loading, nor the second is included. I tried several code versions, always in child and parent theme (never both at the same time), but absolutly nothing happens. What am i doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try out your jQuery in JSFiddle with the version of jQuery WordPress uses and see if it still works.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    If the version of jQuery is responsible then try using this plugin http://wordpress.org/plugins/jquery-updater/

    Thread Starter pb_advancis

    (@pb_advancis)

    Ok thanks for that, the updater successfully replaced the jquery file from WP and now it seems to work.

    I just don´t understand why it worked with the updater and not with the code in the functions.php. Basically both do the same thing:

    PLUGIN:

    function rw_jquery_update() {
    		wp_deregister_script('jquery');
    		wp_enqueue_script('jquery', plugins_url('/js/jquery-2.0.3.min.js', __FILE__), false, '2.0.3');
    		// @since 2.0.0 also load the migrate plugin
    		wp_enqueue_script('jquery-migrate', plugins_url('/js/jquery-migrate-1.2.1.min.js', __FILE__), array('jquery'), '1.2.1'); // require jquery, as loaded above
    }
    
    add_action('wp_enqueue_scripts', 'rw_jquery_update');

    FUNCTIONS.PHP:

    function add_google_jquery() {
       if ( !is_admin() ) {
          wp_deregister_script('jquery');
          wp_enqueue_script('jquery','http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js',,'1.4.1',true);
       }
    }
    add_action('wp_print_scripts ', 'add_google_jquery');

    But the problem i now have is, that my scripts don´t seem to work 100% with jquery 2, because the site doesn´t scroll so smooth like before. Is there a way to replace WPs jquery with 1.6.4. ?

    It´s included in the plugin folder, so i tried editing the path to the 1.6.4.-file, but that broke the plugin, as well as using the google link. It seems to only work when using the latest file ?!…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Double jquery – wp_deregister_script seems to be ignored’ is closed to new replies.