0

I'm using the code below to add a logo in the header of certain pages and I'm wodering if there a way to add the logo(sublogo.jpg) to certain categories as well as "page-one", "page-two" and so on?

    <div id="header-logo" onclick="location.href='<?php bloginfo('url'); ?>'" style="cursor: pointer;" >
    <?php if (is_page(array('page-one', 'page-two', 'page-three','page-four'))) $logo_image = 'subLogo.jpg';
    else $logo_image = 'mainLogo.jpg';?>
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/<?php echo $logo_image;?>" alt="<?php bloginfo('name'); ?>" />
    </div>

Thanks,

1 Answer 1

2

extend this line:

<?php if (is_page(array('page-one', 'page-two', 'page-three','page-four'))) $logo_image = 'subLogo.jpg';

with

|| is_category(array('cat-1', 'cat-2'))

so you get, for example:

<?php if (is_page(array('page-one', 'page-two', 'page-three','page-four')) || is_category(array('cat-1', 'cat-2')) ) $logo_image = 'subLogo.jpg';

http://codex.wordpress.org/Function_Reference/is_category

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.