• 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.