Display different header per category that post is in.
-
Ok I am trying to have a custom header be displayed when viewing a post within certain categories.
I seem to only find instructions on how to display custom headers on the actual category pages.
I have tried this code with no luck:
<?php if ( is_category('7') ) : get_header('freelance'); elseif ( is_category('17') ) : get_header('freelance'); elseif ( is_category('18') ) : get_header('freelance'); elseif ( is_category('19') ) : get_header('freelance'); elseif ( is_category('20') ) : get_header('freelance'); elseif ( is_category('21') ) : get_header('freelance'); elseif ( is_category('22') ) : get_header('freelance'); elseif ( is_category('23') ) : get_header('freelance'); elseif ( is_category('24') ) : get_header('freelance'); else : get_header(); endif; ?>
I have also tried the same code with the slugs:
<?php if ( is_category('support') ) : get_header('freelance'); elseif ( is_category('domain') ) : get_header('freelance'); elseif ( is_category('email') ) : get_header('freelance'); elseif ( is_category('file-management') ) : get_header('freelance'); elseif ( is_category('godaddy') ) : get_header('freelance'); elseif ( is_category('justhost') ) : get_header('freelance'); elseif ( is_category('wordpress') ) : get_header('freelance'); elseif ( is_category('xhtml-css-php') ) : get_header('freelance'); elseif ( is_category('troubleshooting') ) : get_header('freelance'); else : get_header(); endif; ?>
Am I simply doing something wrong? Or does this not work at all?
Thanks in advance!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Display different header per category that post is in.’ is closed to new replies.