Created
October 16, 2012 19:39
-
-
Save BFTrick/3901484 to your computer and use it in GitHub Desktop.
Load jQuery From CDN With Local Fallback
This file contains 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
//include jquery - use an empty file path which is basically a promise to WP that you'll hardcode it into your theme | |
wp_deregister_script('jquery'); | |
wp_register_script('jquery', '', FALSE, '1.8.0', true); | |
wp_enqueue_script('jquery'); |
Switched to using the Ben Everard method instead. You still have to include the HTML5 Boilerplate jquery loading method in your theme.
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="<?= get_stylesheet_directory_uri(); ?>/assets/js/jquery-1.8.0.min.js"><\/script>')</script>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired from WPShock.
I'm still not successfully passing the
$url
variable into theload_external_jQuery()
method.