Reputation: 37
Need to add custom header according to category ID via functions.php
.
I set 2 headers pages: header-19.php
and header-20.php
.
but nothing happens. what I'm doing wrong?
function my_custom_header() {
if(is_category('19')) {
get_header('19');
} elseif(is_category('20')) {
get_header('20');
} else {
get_header();
}
}
Upvotes: 0
Views: 136
Reputation: 1229
Try this
function my_custom_header() {
if (is_category('19')) :
get_header('19');
elseif (is_category('20')) :
get_header('20');
else :
get_header();
endif;
}
Then in your page add this
<?php my_custom_header(); ?>
Upvotes: 1