Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My objective - Display some code on every page apart from 2 pages.

Now this code works fine with only one page (if its not is_home, display code)...

<?php if (!is_home()) { ?>  
(some content)
<?php ?>

... but when I try to do it for two pages, the rule fails, and the code is displayed on both the pages where I do not want it visible...

<?php if( !is_home() or !is_archive()) { ?> 
(some content)
<?php ?>

I am unsure why this fails, any help would be great.

Thanks in advance.

share|improve this question
    
use if ((!is_home()) || (!is_archive())) –  Kuldeep Daftary Dec 9 '12 at 0:38
    
thanks but that doesn't work either. –  Adam Dec 9 '12 at 0:46

1 Answer 1

up vote 1 down vote accepted

If you're testing against two falses you have to use the logical AND operator, because BOTH have the be false.

<?php if( !is_home() && !is_archive()) { ?> 
(some content)
<?php ?>
share|improve this answer
    
Yes! I knew it was something like that but couldn't put my finger on it. Thanks! –  Adam Dec 9 '12 at 13:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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