I am trying to change my header depending on the category. I have tried the id and the slug and for some reason it is not working. There must be something wrong with my method. I am using a if else statement.
if ( is_category('6') ) {
get_header( 'news' );}
else {
get_header();
}
I have also tried:
if ( is_category('news') ) {
get_header( 'news' );}
else {
get_header();
}
My header is named header-news.php
I was using the info from this page:
http://codex.wordpress.org/Conditional_Tags#A_Category_Page
Any help would be appreciated.
I am changing the single.php
I did first try calling the header-news.php first to make sure it works and it did, my if else statement seems to be wrong.
Ok, so the answer to this is to use:
in_category
http://codex.wordpress.org/Template_Tags/in_category
I changed the code to read:
It worked perfectly!
is_category
is intended for archive pages;in_category
is for use within the loop.