Wordpress: Upgrade an old theme\'s jQuery


/ Published in: JavaScript
Save to your folder(s)

Eventually, you're going to need to style this website so here are a few tricks


Copy this code and paste it in your HTML
  1. /** ******** ******** ******** ******** ******** ******** ******** ********
  2. * TITLE: YOO THEME STYLING OF CSS, JS, AND FONTS
  3. * DESCRIPTION: Eventually, you're going to need to style this website so here are a few tricks
  4. *
  5. * http://codex.wordpress.org/Function_Reference/wp_enqueue_script
  6. * http://yootheme.com/themes/documentation/customizing/add-new-css-js-or-fonts
  7. */
  8. function upgrade_jquery(){
  9. //using a newer version of jQuery will break stuff in WP admin
  10. if (!is_admin()) {
  11. //Remove existing jquery
  12. wp_deregister_script('jquery');
  13. wp_dequeue_script('jquery');
  14.  
  15. //Add new jQuery
  16. wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', false, '2.1.1');
  17. wp_enqueue_script('jquery');
  18.  
  19. wp_register_script('jquery-migrate', 'http://code.jquery.com/jquery-migrate-1.2.1.min.js', false, '1.2.1');
  20. wp_enqueue_script('jquery-migrate');
  21. }
  22. }
  23. add_action( 'wp_enqueue_scripts', 'upgrade_jquery', 100 );

URL: http://yootheme.com/themes/documentation/customizing/add-new-css-js-or-fonts

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.