Multiple Headers using Conditional Tags
-
I’ve been working to try and make a different header image to appear when a user clicks over to a specific category on the blog. I got it to work with pages. (I have that turned off at the moment) I am using the conditional tags that are defined in the Codex. I also want a random image to appear on pages or sections that don’t have a specific image applied to them. Below is the code I am using. Anyone have any suggestions?
<?php
if (is_category(fedora-core-linux))
{
include(get_template_directory() . ‘/headers/fedora-header.php’);
}
else if (is_category(free-software))
{
include(get_template_directory() . ‘/headers/free-header.php’);
}
else if (is_category(microsoft-windows))
{
include(get_template_directory() . ‘/headers/windows-header.php’);
}
else if (is_category(miscellaneous-tech))
{
include(get_template_directory() . ‘/headers/misc-header.php’);
}
else if (is_category(ubuntu-linux))
{
include(get_template_directory() . ‘/headers/ubuntu-header.php’);
}
else if (is_category(web-design-treasures))
{
include(get_template_directory() . ‘/headers/treasures-header.php’);
}
else {
include(get_template_directory() . ‘/images/headers/rotatable/rotate.php’);
}
?>If it helps, you can view the install I am working on at:
- The topic ‘Multiple Headers using Conditional Tags’ is closed to new replies.