Conditional Header Based On Category
-
Hi,
Having a bit of trouble with header.php in a custom theme. I’d like a particular image to display based on if the archive posts are from a given category -or- if it’s a single post and the post is in that particular category.
Something is definitely wrong with the code below. It works for category(34). And when one selects an archive for category(35) BUT when one returns back to the index, the image is retained for category(35)… as if something is still being ‘remembered’ from before. Any ideas? Or is there a syntax issue?
TIA,
—JC
<?php
if( is_category(’34’) )
echo “<img src=’https://jchmusic.com/frametop-newsflash.gif’ alt=’page header’/>”;elseif( is_category(’35’) )
echo “<img src=’https://jchmusic.com/frametop-faq.gif’ alt=’faq page header’/>”;elseif( !is_category() && in_category(34) )
echo “<img src=’https://jchmusic.com/frametop-newsflash.gif’ alt=’page header’/>”;elseif( !is_category() && in_category(35) )
echo “<img src=’https://jchmusic.com/frametop-faq.gif’ alt=’page header’/>”;else
echo “<img src=’https://jchmusic.com/frametop-weblog.gif’ alt=’blog page header’/>”;?>
- The topic ‘Conditional Header Based On Category’ is closed to new replies.