Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6992051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:35:05+00:00 2026-05-27T19:35:05+00:00

I am making a theme for my site which is WordPress based. I wanted

  • 0

I am making a theme for my site which is WordPress based. I wanted a small help as I am not an expert on php. My issue is like this:

I have a side bar div which again within it has 4 sidebars:

 <div id="jp-double-bar" class="equal">
    <?php if ( is_active_sidebar( 'double-top' ) ) : ?>
    <div class="jp-double-top">
        <?php dynamic_sidebar( 'double-top' ); ?>
    </div>
    <?php endif; ?>
    <div class="double-middle">
        <?php if ( is_active_sidebar( 'middle-2' ) ) : ?>
        <div class="jp-middle-2 equalmiddle">
            <?php dynamic_sidebar( 'middle-2' ); ?>
        </div>
        <?php endif; ?>
        <?php if ( is_active_sidebar( 'middle-1' ) ) : ?>
        <div class="jp-middle-1 equalmiddle">
            <?php dynamic_sidebar( 'middle-1' ); ?>
        </div>
        <?php endif; ?>
    </div>
    <?php if ( is_active_sidebar( 'double-bottom' ) ) : ?>
    <div class="jp-double-bottom">
        <?php dynamic_sidebar( 'double-bottom' ); ?>
    </div>
    <?php endif; ?>
</div>

Here my issue is that if I do not publish any widgets in any of the sidebars, still the outer <div id="jp-double-bar"> shows up.

My question is……. The way we are wrapping for individual sidebar with an <?php if ():?> statement, is there a way to wrap the main outer div with 4 if statements.

Like if there is no widget published in any of the 4 sidebars then the main outer div should not display at all.

Kindly help.

Regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:35:06+00:00Added an answer on May 27, 2026 at 7:35 pm

    It seems that you have to be using the wp_get_sidebars api call to retrieve the bars. Check and see if this has a length of zero (empty).

    Or just use and statements

    if (is_active_sidebar( 'double-bottom' ) && is_active_sidebar('') && ...) {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm testing a new template for a wordpress based site, and I'd like to
OK, Ive built a status feed for this site Im making which shows a
I'm making a wordpress theme options page, and one of the options I want
I'm working on a WordPress site that uses a dynamically generated menu system which
I am making a static site which is 'forced' to be cached via Cache-control
I am making a web-site , which is a social network. There is need
I'm making a site in which I'm using jQuery to change background images on
I've been tasked with making an already existing e-commerce site SE friendly - which
I am making a website in Adobe Dreamweaver with php. In the site there’s
I'm working on making a site fully functional under HTTPS. As part of this,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.