Return to Snippet

Revision: 50471
at August 24, 2011 01:58 by adambundy


Initial Code
------------------------------------------------

This must be inserted into the functions.php file:

function modify_jquery() {
	if (!is_admin()) {
		// comment out the next two lines to load the local copy of jQuery
		wp_deregister_script('jquery');
		wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js', false, '1.6.1');
		wp_enqueue_script('jquery');
	}
}
add_action('init', 'modify_jquery');

------------------------------------------------

This must be inserted into the header.php file (BEFORE WP_HEAD CALL!):

<?php wp_enqueue_script("jquery"); ?>

------------------------------------------------

jQuery functions should be wrapped in this so that $ operator represents no-conflict (BELOW WP_HEAD):

<script type='text/javascript'>
jQuery(document).ready(function($) {
	
	
    // $() will work as an alias for jQuery() which is noconflict mode inside of this function
});
</script>

------------------------------------------------

Initial URL

                                

Initial Description

                                

Initial Title
WordPress Enqueue jQuery - Google CDN

Initial Tags
wordpress, jquery

Initial Language
PHP