Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created May 15, 2012 17:58
Show Gist options
  • Save jo-snips/2703738 to your computer and use it in GitHub Desktop.
Save jo-snips/2703738 to your computer and use it in GitHub Desktop.
Wordpress: Add jQuery from Google
/*-----------------------------------------------------------------------------------*/
/* Add jQuery
/*-----------------------------------------------------------------------------------*/
// Call the google CDN version of jQuery for the frontend
// Make sure you use this with wp_enqueue_script('jquery'); in your header
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment