calling a specific header
-
I’m trying to get my header (that’s visual header not <header>) to change depending on what category the post is in.
To start with I have this as my code:
//<?php
// code for changing headers
if (is_home()) {
// homepage
echo “<style type=’text/css’> #masthead {
background: url(http://www.bombshellstudios.com/legion/images/banner.jpg);}
</style>”;
} elseif (is_category(3)) {
// ironquest category
echo “<style type=’text/css’> #masthead {
background: url(http://www.bombshellstudios.com/legion/images/iron_header.jpg);}
</style>”;
} elseif (is_category(9)) {
// ironquest category
echo “<style type=’text/css’> #masthead {
background: url(http://www.bombshellstudios.com/legion/images/iron_header.jpg);}
</style>”;
} elseif (is_category(2)) {
// book of emptiness category
echo “<style type=’text/css’> #masthead {
background: url(http://www.bombshellstudios.com/legion/images/boe_header.jpg);}
</style>”;
} else {
// everything else
echo “<style type=’text/css’> #masthead {
background: url(http://www.bombshellstudios.com/legion/images/banner.jpg);}
</style>”;
}
//?>This works great when clicking a category but if I click the title of a post, or any other way of accessing a single post, it doesn’t work. By the way this script is in my <header></header>. My question is, how do I call the category of any post that is made so that this script will recognize it, even if the category itself wasn’t how it was accessed?
I hope I made this clear. Thanks for any help.
The topic ‘calling a specific header’ is closed to new replies.