Dear Support,
I would like to load the google CDN jQuery from the footer (at the moment is loaded from the header).
I have added the below code in the functions.php however, once I do so the stretch row and content applied to the homepage (e.g. in the banner and the blogs row) does not longer work. It looks like that this functionality gets disabled.
Could you please help me to understand the reason and fix the problem?
Alternatively, help me to implement a code in the theme that forces google CDN to be loaded from the footer?
This is the code that I added:
add_action('init', 'use_jquery_from_google');
function use_jquery_from_google () {
if (is_admin()) {
return;
}
global $wp_scripts;
if (isset($wp_scripts->registered['jquery']->ver)) {
$ver = $wp_scripts->registered['jquery']->ver;
$ver = str_replace("-wp", "", $ver);
} else {
$ver = '1.12.4';
}
wp_deregister_script('jquery');
wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/$ver/jquery.min.js", false, $ver);
}
Thanks.
Fabio.