Return to Snippet

Revision: 88490
at March 1, 2022 01:00 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2014/09/13/wordpress-upgrade-an-old-jquery/

Updated Code
https://www.chrisjmendez.com/2014/09/13/wordpress-upgrade-an-old-jquery/

Updated Description
https://www.chrisjmendez.com/2014/09/13/wordpress-upgrade-an-old-jquery/

Revision: 67368
at September 13, 2014 10:47 by chrisaiv


Initial Code
/** ******** ******** ******** ******** ******** ******** ******** ******** 
* TITLE:       YOO THEME STYLING OF CSS, JS, AND FONTS
* DESCRIPTION: Eventually, you're going to need to style this website so here are a few tricks
* 
* http://codex.wordpress.org/Function_Reference/wp_enqueue_script
* http://yootheme.com/themes/documentation/customizing/add-new-css-js-or-fonts
*/
function upgrade_jquery(){
	//using a newer version of jQuery will break stuff in WP admin
    if (!is_admin()) {
	//Remove existing jquery
	wp_deregister_script('jquery');
	wp_dequeue_script('jquery');

	//Add new jQuery
	wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', false, '2.1.1');
	wp_enqueue_script('jquery');
	
	wp_register_script('jquery-migrate', 'http://code.jquery.com/jquery-migrate-1.2.1.min.js', false, '1.2.1');
	wp_enqueue_script('jquery-migrate');
    }	
}
add_action( 'wp_enqueue_scripts', 'upgrade_jquery', 100 );

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

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

Initial Title
Wordpress: Upgrade an old theme\'s jQuery

Initial Tags
wordpress

Initial Language
JavaScript