I am loading scripts like this:
//load scripts
//wp_register_script( $handle, $src, $deps, $ver, $in_footer );
add_action('wp_enqueue_scripts', 'load_scripts');
function load_scripts() {
if (!is_admin()) {
wp_register_script('modernizr', get_bloginfo('template_directory') .'/scripts/modernizr-latest.js',false);
wp_enqueue_script('modernizr');
wp_enqueue_script('jquery', true );
wp_register_script('cookie',get_bloginfo('template_directory') . '/scripts/cookie.js', array('jquery'), '1.0',true);
wp_enqueue_script('cookie');
wp_register_script( 'Gmaps', 'http://maps.google.com/maps/api/js?sensor=false', true );
wp_enqueue_script ('Gmaps');
wp_register_script('plugins', get_bloginfo('template_directory') .'/scripts/plugins.js',true);
wp_enqueue_script('plugins');
wp_register_script( 'maps_scripts', get_bloginfo('template_directory') . '/scripts/maps.js', array('Gmaps'), '1.0', true );
wp_enqueue_script ('maps_scripts');
wp_register_script('history', get_bloginfo('template_directory') .'/scripts/history.js', array('jquery'), '1.0',true);
wp_enqueue_script('history');
}
}
With this I expect to see all scripts except modernizr loaded into the footer. Instead it is an incorrect mish-mash. From this example jquery, google maps, and the plugins.js still load in the header even though $in_footer
is set to true. Cookie, maps, and history load in the footer as expected.
Can someone please help explain this to me?