is_active_sidebar() returning different values
-
I’m working on a template which requires me to have different classes on a div, depending on 2 sidebars. If one or both of the sidebars are inactive, meaning has no widgets (not talking about widgets with no output), the respective div should have different classes. It’s all working, exccept one instance…
My code is:
<?php $ltActive = is_active_sidebar('lt'); $rtActive = is_active_sidebar('rt'); if($ltActive && $rtActive){ $class = 'grid_6'; }elseif(!$ltActive && !$rtActive){ $class = 'grid_12'; }else{ $class = 'grid_9'; // <== } ?> <div class="<?php echo $class; ?> eqh">
If both the sidebars are active it’s working, if none of the sidebars are active it’s working, if the
rt
sdebar is active and thelt
sidebar is not, it’s working, but if thelt
is active and thert
is not, it’s not working.Also, I’m only displaying the divs containing the sidebars if there are active widgets in it, and that’s working (O.o), meaning, it doesn’t display the
rt
sidebar.I’ve echoed the state of the sidebars with
<p>right sidebar: <?php echo is_active_sidebar('rt') ?> and left sidebar: <?php echo is_active_sidebar('lt') ?></p>
and I get different values within the same page… Ceck it out here: https://kendallellis.co/energy-and-infrastructure/Someone tell me what the hell is going on PLEASE!!
- The topic ‘is_active_sidebar() returning different values’ is closed to new replies.