The WordPress wp_head () method only outputs scripts or styles that have the last parameter in WordPress wp_enqueue_script () set to false .. when set to true , it will be displayed in the footer using wp_footer ()
you can change the priority when called and inserted by setting the $ priority parameter in add_action ()
http://codex.wordpress.org/Function_Reference/add_action
$ priority (int) (optional) Used to indicate the order in which the functions associated with a particular action are performed. Lower numbers correspond to earlier execution, and functions with the same priority are performed in the order in which they were added to the action. Default: 10
add_action( $hook, $function_to_add, $priority, $accepted_args );
And also consider the following two WordPress methods:
wp_enqueue_script () :
https://developer.wordpress.org/reference/functions/wp_enqueue_script/
wp_enqueue_script( string $handle, string $src = '', array $deps = array(), string|bool|null $ver = false, bool $in_footer = false )
wp_register_script () :
https://developer.wordpress.org/reference/functions/wp_register_script/
wp_register_script( string $handle, string $src, array $deps = array(), string|bool|null $ver = false, bool $in_footer = false )
Try it.
You may have to play with the $ priority parameter
function my_scripts() { wp_register_script('app-js', get_template_directory_uri() . '/javascripts/app.js', array('jquery'), null, true ); wp_enqueue_script('app-js'); } add_action( 'wp_enqueue_scripts', 'my_scripts', 20, 1);