Below is my code for enqueue my scripts and css. I am trying to get the JavaScripts to load in the footer of my site, but when I view source I see them loading in the header. I suppose the “true” value isn’t working properly or I have sequenced the code incorrectly?
// Enque CSS and JavaScript
if (!is_admin()) {
// CSS Reset
wp_register_style( 'reset', get_template_directory_uri() . '/css/reset.css');
wp_enqueue_style( 'reset' );
// 960 GS
wp_register_style( 'grid', get_template_directory_uri() . '/css/960.css');
wp_enqueue_style( 'grid' );
// Style
wp_register_style( 'style', get_template_directory_uri() . '/style.css');
wp_enqueue_style( 'style' );
// jQuery
wp_deregister_script('jquery');
wp_register_script('jquery',("http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"), true);
wp_enqueue_script('jquery');
// jQuery UI
wp_deregister_script('jquery-ui-core');
wp_register_script('jquery-ui-core',("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"), true);
wp_enqueue_script('jquery-ui-core');
// Easy Slider
wp_register_script('easy-slider',get_bloginfo('template_directory') . "/js/easySlider1.7.js", true);
wp_enqueue_script('easy-slider');
// Scripts
wp_register_script('myscript',get_bloginfo('template_directory') . "/js/scripts.js", true);
wp_enqueue_script('myscript');
// Facebook API
wp_register_script('facebook-loader',("http://static.ak.fbcdn.net/connect.php/js/FB.Loader"), true);
wp_enqueue_script('facebook-loader');
wp_register_script('facebook-sharer',("http://static.ak.fbcdn.net/connect.php/js/FB.Share"), true);
wp_enqueue_script('facebook-sharer');
// Twitter API
wp_register_script('twitter',("//platform.twitter.com/widgets.js"), true);
wp_enqueue_script('twitter');
}
You need top put it into an actual function and then call the function via an action, but to answer your question.
Your setting the third parameter to
true
but that param is for the$deps
(dependency). The footer is the 5th parameter called$in_footer
.So it should be:
Reference: