Here is some information for you so that you understand how things work with wp_enqueue_scripts.
You need to know the priority order for the wp_enqueue_scripts. Please check the below order of the hooks can be run........
- muplugins_loaded
- registered_taxonomy
- registered_post_type
- plugins_loaded
- sanitize_comment_cookies
- setup_theme
- load_textdomain
- after_setup_theme
- auth_cookie_malformed
- auth_cookie_valid
- set_current_user
- init
- widgets_init
- register_sidebar
- wp_register_sidebar_widget
- wp_default_scripts
- wp_default_stypes
- admin_bar_init
- add_admin_bar_menus
- wp_loaded
- parse_request
- send_headers
- parse_query
- pre_get_posts
- posts_selection
- wp
- template_redirect
- get_header
- wp_head
- wp_enqueue_scripts
- wp_print_styles
- wp_print_scripts
... and so one.....
So you see you can add it in the init hook and doing so it will be called as high priority than below the listing.
If you found your files are not loading and you surely can use a high priority hook.
If you found your wp_enqueue_script is not being called, you can use this simple trick to get it work for your theme or plugin.
<?php
function my_slider_scripts() {
$scriptsrc = get_stylesheet_directory_uri().'/js/jquery.nivo.slider.pack.js';
wp_register_script( 'nivo-slider-pack', $scriptsrc );
wp_enqueue_script('nivo-slider-pack');
}
add_action( 'init', 'my_slider_scripts' );
?>