Support » Plugin: Restrict Widgets » About "Modify is_active_sidebar()" checkbox

  • Resolved Hassan


    What does this checkbox actually do?

    Here’s how I understand it:
    If it is checked and if the displayed page does have a sidebar but based on RW options no widgets were available in this sidebar for this page, then the sidebar HTML will not render (i.e. is_active_sidebar() will return FALSE).

    Is this how it should work? Because I’ve tried that and it does not seem to be working that way.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author dFactory


    Let me provide an example:

    <?php if (is_active_sidebar('left-sidebar-area')) { ?>
        <div class="sidebar left-sidebar four columns">
            <?php dynamic_sidebar('left-sidebar-area'); ?>
    <?php } ?>

    By default, if left sidebar area conains any widget, the is_active_sidebar() will return TRUE and display <div> and everything it contains. When you use RW and insert a Text Widget into it, but set it to display only on frontpage of your site, the is_active_sidebar() will still return TRUE and display empty <div> an all other pages. If you enable the checkbox, this function will return TRUE and display <div> and a widget it contains on front page, and return FALSE an all other pages, so there will be no widget and no <div> displayed.

    We use it to build flexible layouts, where grid of certain page is changing, depending on the widgets settings. It’s a simple, but very useful option.

    This is what I expected. And thanks for the explanation.

    The thing is, this does not appear to be working for me; the empty div still appears when there are no widgets even though I’ve selected that checkbox.

    Plugin Author dFactory


    Did you try that on one of the themes shipping with WordPress? Did you use that with WPML, or you tested that on one language installation?

    My site is not using the default theme, However, my sidebar.php template file has only this code

    <?php if ( is_active_sidebar( 'main-sidebar' ) ) : ?>
    	<?php dynamic_sidebar( 'main-sidebar' ); ?>
    <?php endif; ?>

    …and no, I am not using this with WPML on this site.

    Off-topic: I don’t seem to be getting any email notifications for the posts I make on your support forums here even though I’ve ticked the box at the bottom of this form. This only happens on the forums of your plugins, all other posts in other support forums on work fine. Any clue why?

    Plugin Author dFactory


    Hassan, if you are not doing anything specific in your theme, you don’t really need this option.

    I think we’ll provide some use cases of that in plugin documentation (if we just find some time to do that).

    Forum notifications? No idea this is so. Try contacting someone from the moderators maybe.

    I don’t seem to be getting any email notifications for the posts I make on your support forums here

    Check your spam folder(s).

    Thanks @dFactry.

    About the forum email notification, I just received @esmi‘s above post via email, but did not receive @dfactory‘s post. This appears to be only specific to posts by @dfactory‘s account as I am receiving other notification from other plugin forums without issues. And no, nothing is in my spam folder.

    I’m afraid I can’t account for that unless you have a filter on incoming mail that is deleting emails before they hlt any folders. All of the notifications will come from donotreply+matcher [ at]wordpress [dot [org], so – best guess – this could some sort of pattern match on the subject or mail content that is incorrectly removing these mails.

    Hi @esmi,

    I don’t have such rules/filters, and email notifications come from noreply not donotreply at wordpress dot org. This behavior is weird all in all since it only affects dFactory’s posts :/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘About "Modify is_active_sidebar()" checkbox’ is closed to new replies.