WordPress: jquery.js wont move to footer

function uw_load_scripts() {
// De-register the built in jQuery
wp_deregister_script('jquery');
// Register the CDN version
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js', array(),'','1.1', true); 
// Load it in your theme
wp_enqueue_script( 'jquery' );
}
add_action( 'wp_enqueue_scripts', 'uw_load_scripts' );

I have this nice function in mytheme/function.php. They say this should move the js to the footer, but in my case it doesn’t. Any idea on why or/and how to move it to footer?

Related posts

Leave a Reply

4 comments

  1. HOW IT WORKS

    Here in your code $in_footer parameter of wp_register_script() is set to true.

    You can enqueue in the footer by setting the $in_footer parameter to true in your call to wp_enqueue_script() or wp_register_script()

    Reference>>

    WHY YOU CANT

    Your link towards jquery seems to be invalid. Use correct link.
    You can use this one instead;

    http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
    

    AND
    Change version accordingly or set false,

    Where version is,

    String specifying the script version number, if it has one, which
    is concatenated to the end of the path as a query string. If no version is
    specified or set to false, then WordPress automatically adds a version number
    equal to the current version of WordPress you are running. If set to null no
    version is added. This parameter is used to ensure that the correct version
    is sent to the client regardless of caching, and so should be included if a

  2. **Try below code

    function uw_load_scripts() {
    // De-register the built in jQuery
    wp_deregister_script('jquery');
    // Register the CDN version
    wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.1.10/jquery.min.js', array(),'','1.1', true); 
    // Load it in your theme
    wp_enqueue_script( 'jquery' );
    }
    add_action( 'wp_enqueue_scripts', 'uw_load_scripts' );
    

    from function.php or comment it.
    Now add your js to your theme/footer.php**
    Code :

          <script type="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>