From b7cd04899df994d2cc004ac32c78e7f5b76a91af Mon Sep 17 00:00:00 2001 From: Foxaii Date: Wed, 6 Mar 2013 17:19:57 +0000 Subject: [PATCH 1/6] Add jQuery CDN to theme features. --- lib/config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/config.php b/lib/config.php index e951476..7b8b724 100644 --- a/lib/config.php +++ b/lib/config.php @@ -8,6 +8,7 @@ add_theme_support('h5bp-htaccess'); // Enable HTML5 Boilerplate's .htacc add_theme_support('bootstrap-top-navbar'); // Enable Bootstrap's top navbar add_theme_support('bootstrap-gallery'); // Enable Bootstrap's thumbnails component on [gallery] add_theme_support('nice-search'); // Enable /?s= to /search/ redirect +add_theme_support('jquery-cdn'); // Enable to load jQuery from the Google CDN /** * Configuration values From 6298ec18c73c2f255cb9f8e3b4068e4f4b706e14 Mon Sep 17 00:00:00 2001 From: Foxaii Date: Wed, 6 Mar 2013 17:23:43 +0000 Subject: [PATCH 2/6] Add jQuery CDN to theme features. --- lib/scripts.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/scripts.php b/lib/scripts.php index 0c0888a..437d7d0 100644 --- a/lib/scripts.php +++ b/lib/scripts.php @@ -27,9 +27,10 @@ function roots_scripts() { // jQuery is loaded using the same method from HTML5 Boilerplate: // Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline // It's kept in the header instead of footer to avoid conflicts with plugins. - if (!is_admin()) { + if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', false, null, false); + add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); } if (is_single() && comments_open() && get_option('thread_comments')) { @@ -61,9 +62,6 @@ function roots_jquery_local_fallback($src, $handle) { return $src; } -if (!is_admin()) { - add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); -} function roots_google_analytics() { ?>