Closed dotherightthing closed 7 years ago
@dotherightthing the fix for the issue has been added on the develop branch. In which you can also download directly here and let me know how it goes. My apology for late response.
Cheers, Jeffrey
Hello!
I think I have the same issue here :(
If I don't select any widgets for a page there still is an empty space - I think if the sidebar turns up false the problem will be solved! I tried the download - but that did not make any change.
Can you help me with this problem?
Kind regards, Anna-Webdesign
@phpbits Thanks for the update. I can't replicate my original scenario as the project has moved on, but I did a quick test and can replicate the problem in version 3.3.2 - but not in the linked version 3.4 thanks.
This is my sidebar setup (sidebar.php from twentysixteen). The fix prevents the #secondary
container from being output, if there are no widgets assigned to 'Sidebar'.
<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<aside id="secondary" class="sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</aside><!-- .sidebar .widget-area -->
<?php endif; ?>
@dotherightthing Sounds perfect! I've also got handful of other users that tested it out and seems to be working as expected : https://wordpress.org/support/topic/honor-is_active_sidebar-conditional-when-using-show-on-checked/ . This will be included on the next update along side with brand new features and I hope you'll love them. Thanks!
Cheers, Jeffrey
@Anna-Webdesign That will be depending on the theme you are using. If the theme is not using is_active_sidebar()
condition to change the template to a full width when empty then there will be a blank space on the page. Thanks!
The Wordpress function
is_active_sidebar()
can be used to check whether any widgets are loaded into a sidebar.When a widget is loaded into the sidebar but is hidden via Widget Options, I expect
is_active_sidebar()
to returnfalse
.Currently it returns
true
-is_active_sidebar()
treats a hidden widget as an active widget.Can you inform Wordpress that a hidden widget is not active?
Thanks, Dan