Let’s say I have a category named as catname
(the slug would be catname
). I want the header styled differently when visitors open the category catname.
The article on Ghacks explains how to create a custom header (styled differently) when visitors open the category catname, achieved by creating header-catname.php and including it in category-catname.php with include(TEMPLATEPATH.'/header-catname.php');
(instead of the usual get_header();
). You can read the short article itself if my explanations is difficult to follow (I apologize for my lack of proficient English).
My question is: what is the advantage of using above method, over using is_category ('catname')
in header.php to create custom header only for the catname category?
I mean, in the header.php we could just use this without creating additional header-catname.php:
<?php if ( is_category('catname') ) { ?>
/* Insert custom header for category catname here */
<?php } else { ?>
/* Insert the usual header here */
<?php } ?>
Does using the conditional IF make the page load slower? Or is there any disadvantage?