I am trying to load JQuery hosted on Google in my blog's footer just before the body finishes. This is the function I am using in my functions.php file.
function load_jquery() {
if (!is_admin()) {
wp_deregister_script('jquery');
// load the Google API copy in the footer
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', array(), '1.5.1', 1);
wp_enqueue_script('jquery');
}
}
add_action('init', 'load_jquery');
However it keeps being loaded in the header. I can't figure out why.
I also added the following function in the functions.php file and it works fine;
function your_function() {
echo '<p>This is inserted at the bottom</p>';
}
add_action('wp_footer', 'your_function');
Appreciate the help.