Title: is_active_sidebar conditional logic &#8211; doing something wrong
Last modified: August 20, 2016

---

# is_active_sidebar conditional logic – doing something wrong

 *  [reddo](https://wordpress.org/support/users/reddo/)
 * (@reddo)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/is_active_sidebar-conditional-logic-doing-something-wrong/)
 * I’m trying to achieve to show different classes depending on active sidebars 
   for self-explanatory reasons.
 * I’m using the following code:
 *     ```
       <?php if ( is_active_sidebar('lt') && is_active_sidebar('rt')) { ?>
   
         <div class="grid_6 eqh">
   
       <?php } elseif ( !is_active_sidebar('lt') || !is_active_sidebar('rt')) { ?>
   
         <div class="grid_9 eqh">
   
       <?php } elseif ( !is_active_sidebar('lt') && !is_active_sidebar('rt')) { ?>
   
         <div class="grid_12 eqh">
   
       <?php }; ?>
       ```
   
 * But it doesn’t really work. It works if none of the sidebars are active, it displays
   the grid_12 class, if the right sidebar (rt) is active and the left one (lt) 
   isn’t it still works, but couldn’t get it to display the grid_9 class if the 
   left is active and the right isn’t. Could someone point me in the right direction,
   or at least tell me what I’m doing wrong?
 * Any help is appreciated.

The topic ‘is_active_sidebar conditional logic – doing something wrong’ is closed
to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [if else](https://wordpress.org/support/topic-tag/if-else/)
 * [is_active_sidebar](https://wordpress.org/support/topic-tag/is_active_sidebar/)

 * 0 replies
 * 1 participant
 * Last reply from: [reddo](https://wordpress.org/support/users/reddo/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/is_active_sidebar-conditional-logic-doing-something-wrong/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
