• Resolved laling

    (@laling)


    This is my code below, what I’m trying to do is… IF any of the footer-1, footer-2, OR footer-3 sidebars are active, then display the DIV with the sidebars in it. If not, then don’t display the sidebars with the DIV at all. I tried if ( is_active_sidebar( 'footer-1', 'footer-2', 'footer-3' ) ), I’ve also tried if ( is_active_sidebar( array( 'footer-1', 'footer-2', 'footer-3' ) ) ), and I tried if ( is_active_sidebar( 'footer-1' || 'footer-2' || 'footer-3' ) ) I get errors. So how do I properly add the OR conditions for these three sidebars?

    <?php if ( is_active_sidebar( 'footer-1' ) ) { ?>
    
    <div class="footer-sidebar-wrapper">
    	<div class="footer-sidebar-container">
    
    		<div class="footer-sidebar-left"><?php dynamic_sidebar( 'footer-1' ); ?></div>
    		<div class="footer-sidebar-middle"><?php dynamic_sidebar( 'footer-2' ); ?></div>
    		<div class="footer-sidebar-right"><?php dynamic_sidebar( 'footer-3' ); ?></div>
    
    	</div>
    </div>
    
    <?php } ?>
Viewing 1 replies (of 1 total)
  • Thread Starter laling

    (@laling)

    Nevermind! I just solved my own problem. I just needed a few hours to get my head out of the gutter. lol

    This is the right condition code…

    if ( is_active_sidebar( 'footer-1' ) || is_active_sidebar( 'footer-2' ) || is_active_sidebar( 'footer-3' ) ) {
    	blah blah blah here...
    }
Viewing 1 replies (of 1 total)
  • The topic ‘If Sidebars Are Active PHP Conditions’ is closed to new replies.