Merge pull request #704 from Foxaii/master
Add jQuery CDN to theme features
This commit is contained in:
@@ -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-top-navbar'); // Enable Bootstrap's top navbar
|
||||||
add_theme_support('bootstrap-gallery'); // Enable Bootstrap's thumbnails component on [gallery]
|
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('nice-search'); // Enable /?s= to /search/ redirect
|
||||||
|
add_theme_support('jquery-cdn'); // Enable to load jQuery from the Google CDN
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration values
|
* Configuration values
|
||||||
|
|||||||
@@ -27,9 +27,10 @@ function roots_scripts() {
|
|||||||
// jQuery is loaded using the same method from HTML5 Boilerplate:
|
// 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
|
// 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.
|
// 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_deregister_script('jquery');
|
||||||
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', false, null, false);
|
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')) {
|
if (is_single() && comments_open() && get_option('thread_comments')) {
|
||||||
@@ -61,9 +62,6 @@ function roots_jquery_local_fallback($src, $handle) {
|
|||||||
|
|
||||||
return $src;
|
return $src;
|
||||||
}
|
}
|
||||||
if (!is_admin()) {
|
|
||||||
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function roots_google_analytics() { ?>
|
function roots_google_analytics() { ?>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Reference in New Issue
Block a user