Title: Generic Banner specified in CSS
Last modified: August 19, 2016

---

# Generic Banner specified in CSS

 *  Resolved [robhav](https://wordpress.org/support/users/robhav/)
 * (@robhav)
 * [18 years ago](https://wordpress.org/support/topic/generic-banner-specified-in-css/)
 * Hi
 * I am trying to have a banner appear, only when on certain pages. The code I am
   currently using is:
 * > <div <?php if (is_page(’emotional-wellbeing’)) {?>class=”lookhere emotionalwellbeing”
   > <?php } ?>></div>
   >  <div <?php if (is_page(‘healthy-eating-exercise’)) {?>class
   > =”lookhere healthyeating_exercise”<?php } ?>></div> <div <?php if (is_page(‘
   > general-health’)) {?>class=”lookhere generalhealth”<?php } ?>></div>
 * So there are 3 conditions. What I need is another condition that states that 
   if the page is anything other than these pages, there will a be different class
   used (and therefore a generic banner will be displayed).
 * Sorry for asking a php newbie question, but this has been frustrating me for 
   hours!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/generic-banner-specified-in-css/#post-758673)
 * How about this:
 *     ```
       <div <?php
   
       if ( is_page('emotional-wellbeing') ) {
           ?>class="lookhere emotionalwellbeing"<?php
       } elseif ( is_page('healthy-eating-exercise') ) {
           ?>class="lookhere healthyeating_exercise"<?php
       } elseif ( is_page('general-health') ) {
           ?>class="lookhere generalhealth"<?php
       } else {
           // Your code here
       }
       ```
   
 *  Thread Starter [robhav](https://wordpress.org/support/users/robhav/)
 * (@robhav)
 * [18 years ago](https://wordpress.org/support/topic/generic-banner-specified-in-css/#post-758691)
 * Thanks for your reply! I have tried to used an else statement, but can’t seem
   to get the syntax right. At the moment I’ve got the following but it is not parsing
   correctly:
 *     ```
       <div class="lookhere">
       <div <?php
   
       if ( is_page('emotional-wellbeing') ) {
           ?>class="lookhere emotionalwellbeing"<?php
       } elseif ( is_page('healthy-eating-exercise') ) {
           ?>class="lookhere healthyeating_exercise"<?php
       } elseif ( is_page('general-health') ) {
           ?>class="lookhere generalhealth"<?php
       } else {
           ?>class="lookhere contactus"<?php
       }
   
         </div></div>
       ```
   
 *  [wp_guy](https://wordpress.org/support/users/wp_guy/)
 * (@wp_guy)
 * [18 years ago](https://wordpress.org/support/topic/generic-banner-specified-in-css/#post-758695)
 * Aw, sorry… forgot to close the div… Should be something like this:
 *     ```
       <div <?php
   
       if ( is_page('emotional-wellbeing') ) {
           ?>class="lookhere emotionalwellbeing"<?php
       } elseif ( is_page('healthy-eating-exercise') ) {
           ?>class="lookhere healthyeating_exercise"<?php
       } elseif ( is_page('general-health') ) {
           ?>class="lookhere generalhealth"<?php
       } else {
           ?>class="lookhere contactus"<?php
       }
   
       ?>></div>
       ```
   
 *  Thread Starter [robhav](https://wordpress.org/support/users/robhav/)
 * (@robhav)
 * [18 years ago](https://wordpress.org/support/topic/generic-banner-specified-in-css/#post-758724)
 * Awesome. Thanks for your help!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Generic Banner specified in CSS’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [robhav](https://wordpress.org/support/users/robhav/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/generic-banner-specified-in-css/#post-758724)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
