Of course I’m unable to answer you exactly, because I don’t see a full functions.php code.
You can use wp_enqueue_scripts action hook with both, scripts and styles.
Do not call wp_enqueue_script
and wp_enqueue_style
outside of wp_enqueue_scripts
hook.
add_action('wp_enqueue_scripts', 'wp_enqueue_scripts_callback');
function wp_enqueue_scripts_callback(){
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'thickbox' );
wp_enqueue_script( 'media-upload' );
wp_enqueue_script('smoothscroll', get_bloginfo('stylesheet_directory').'/includes/js/smoothscroll.js', array('jquery'), '');
wp_enqueue_script('marker', get_bloginfo('stylesheet_directory').'/includes/map/js/marker.js', array('jquery'), '');
wp_enqueue_script('tinycar', get_bloginfo('stylesheet_directory').'/js/jquery.tinycarousel.min.js', array('jquery'), '');
wp_enqueue_style( 'thickbox' );
if ( is_front_page() ) {
wp_register_script ('googlemaps', 'http://maps.google.com/maps/api/js?&sensor=false', false, '3');
}
wp_enqueue_style('responsive', get_stylesheet_directory_uri() . '/styles/responsive.css',false,'1.0','all');}
}
Just make sure you put it in a right order, because scripts have dependecies.
//here we enqueue jquery
wp_enqueue_script( 'jquery' );
//as example this script has jquery dependency
wp_enqueue_script('smoothscroll', get_bloginfo('stylesheet_directory').'/includes/js/smoothscroll.js', array('jquery'), '');
Also, you can create several callback functions if you prefer to divide scripts and style. It’s your choise.
function wp_enqueue_scripts_callback(){
//wp_enqueue_script here
}
function wp_enqueue_styles_callback(){
//wp_enqueue_style here
}
add_action('wp_enqueue_scripts', 'wp_enqueue_scripts_callback');
add_action('wp_enqueue_scripts', 'wp_enqueue_styles_callback');