I'm looking to add some scripts and styles to particular taxonomy page. For example, I want to have a banner rotator only appear for posts that fall under the "issue" custom taxonomy. I've tried using the is_tax('issue') to control when the scripts and styles are enqueued but that doesn't seem to be working. Here's a sample of my functions.php file:
function init_customizations() {
if (is_tax('issue')) {
wp_register_script('rotator_scripts',get_bloginfo('template_directory').'/includes/issue-rotator.js', array(), '1.0.0' );
wp_enqueue_script('rotator_scripts');
wp_register_style('rotator_styles',get_bloginfo('template_directory').'/includes/issue-rotator.css', array(), '1.0.0', 'screen');
wp_enqueue_style('rotator_styles');
}
}
add_action( 'init', 'init_customizations', 0 );
This doesn't actually write anything to the header so I suspect I may be calling it incorrectly.
Update Here is the final code with the correct answer applied to it:
function init_customizations() {
if (is_tax('issue')) {
wp_register_script('rotator_scripts',get_bloginfo('template_directory').'/includes/issue-rotator.js', array(), '1.0.0' );
wp_enqueue_script('rotator_scripts');
wp_register_style('rotator_styles',get_bloginfo('template_directory').'/includes/issue-rotator.css', array(), '1.0.0', 'screen');
wp_enqueue_style('rotator_styles');
}
}
add_action( 'wp_enqueue_scripts', 'init_customizations', 0 );
init
yet. Try changing the action tag towp