0

I'm using the Roots theme which is tricky to start with. I'm trying to hide the page headers from both index and author pages. I got to do it on index by using the following code:

<?php if(!is_front_page() ){ ?>
<div class="page-header">
  <h1>
    <?php echo roots_title(); ?>
  </h1>
</div>
<?php } ?>

But when I try to add a second conditional to hide it also on author, it doesnt work. This is what I tried:

<?php if(!is_front_page() || !is_author() ) { ?>
<div class="page-header">
  <h1>
    <?php echo roots_title(); ?>
  </h1>
</div>
<?php } ?>

Any idea about what I'm doing wrong?

Thanks! Eric

closed as off-topic by Chip Bennett, tfrommen, fuxia Jan 8 '14 at 15:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions should be specific to WordPress within defined scope (merely happening in its context, such as generic PHP/JS/HTML/CSS, is insufficient). Might be better asked at Stack Overflow or other appropriate site of Stack Exchange network." – Chip Bennett, fuxia
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    As-written, this is a PHP/logic question, and not a WordPress-specific question. Your problem is an incorrect logic condition. Conditions A and B are mutually exclusive, so if ( ! A || ! B ) will always return true. Use if ( ! A && ! B ) instead. – Chip Bennett Jan 8 '14 at 15:21
0

Just a simple logic error. You want to display the header if you're not on the front page AND if you're not on an author page.

if(!is_front_page() && !is_author() ) {

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