I tend to place my wp_enqueue_scripts hooks on my functions.php but this ends up piling up scripts across my site.
Which makes more sense?
1:
function load_slider(){
global $post;
if($post->ID == 11746){ // Load slider on home page
wp_register_script('start-slidorion', get_bloginfo('stylesheet_directory') . '/js/slidorion/start.js', array('slidorion', 'jquery','easing') );
wp_enqueue_script('start-slidorion' );
}
}
add_action('wp_enqueue_scripts', 'load_slider');
2:
function load_slider(){
wp_register_script('start-slidorion', get_bloginfo('stylesheet_directory') . '/js/slidorion/start.js', array('slidorion', 'jquery','easing') );
wp_enqueue_script('start-slidorion' );
}
global $post;
if($post->ID == 11746){ // Load slider on home page
add_action('wp_enqueue_scripts', 'load_slider');
}