Why script not showing at footer section in wordpress?
Because it's already registered for header
, by default, WordPress
does it.
You may use (an easy workaround)
wp_enqueue_script('jquery','/wp-includes/js/jquery/jquery.js','','',true);
You can't omit optional parameters like you did in here wp_enqueue_script( 'jquery',true);
and following won't work
wp_enqueue_script('jquery','','','',true);
Also remember that, this ($in_footer
, to put the script in footer) requires the theme to have the wp_footer() template tag in the appropriate place. Read this article.
Also, you may use
wp_deregister_script( 'jquery' );
wp_register_script(
'jquery',
// you can use "http://code.jquery.com/jquery-latest.min.js" for latest version
/wp-includes/js/jquery/jquery.js,
false,
false,
true
);
wp_enqueue_script( 'jquery' );
Also, check this generator, it gave me following code generated by options I've chosen
// Register Script
function custom_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://code.jquery.com/jquery-latest.min.js', false, false, true );
wp_enqueue_script( 'jquery' );
}
// Hook into the 'wp_enqueue_scripts' action
add_action( 'wp_enqueue_scripts', 'custom_scripts' );
You can generate your own code using this tool very easily.