1

One of my scripts in my Wordpress theme needs an older jQuery Version (1.11.0). All other scripts run on the actual version. My idea was to load the old version at the beginning and using $111 = jQuery.noConflict(); as suggested here. After that the actual jQuery version should be loaded.

Can I place it before the actual version and assign it to e.g. $111 by using wp_enqueue_script?

Community
  • 1
  • 1
vtni
  • 950
  • 3
  • 14
  • 43

1 Answers1

3

It's not a good idea to load second jQuery library. If some of the plugins needs older version of jQuery, try to add jQuery Migrate and see if the old code works.

user1952854
  • 142
  • 3
  • 12
  • unfortunately it doesn't even with jQuery migrate. – vtni Sep 12 '16 at 10:09
  • Тhe best choice is to use only one version of jQuery. If you want you can remove the default jQuery from wordpress and add older version. You can check more here: http://wordpress.stackexchange.com/questions/152559/wordpress-script-loading-unloading-wp-deregister-scriptjquery. Also you can check how to enqueue the proper way libraries to wordpress – user1952854 Sep 12 '16 at 10:33
  • And one more thing, jQuery Migrate should be right after jQuery library, you can try that, if you have not already. – user1952854 Sep 12 '16 at 10:35
  • I tried to use an older version of jQuery, but the `live()` function isn't available and my theme doesn't work then correctly. – vtni Sep 12 '16 at 13:51
  • jQuery Migrate will fix the problem with live() method if it's depricated in your jQuery version – user1952854 Sep 12 '16 at 17:21
  • Thanks a lot, that worked! When I deregistered jquery in the my script, also jquery-migrate was removed. After I registered it again, it works now. – vtni Sep 12 '16 at 18:16