Created
May 15, 2012 17:58
-
-
Save jo-snips/2703738 to your computer and use it in GitHub Desktop.
Wordpress: Add jQuery from Google
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*-----------------------------------------------------------------------------------*/ | |
| /* 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