multiplier
Member
Posted 2 weeks ago #
At the bottom of my theme, I want to have a widgetized region that is wrapped in a div called "footer-widgets". But if there are no widgets activated, I don't want an empty div to show up.
What I'm trying to accomplish is logic like this:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Widgets') ) : ?>
<div id="footer-widgets"><!--widget stuff--></div>
<?php endif; ?>
What would be the right way to do this? Thanks!
Try:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Footer Widgets') ) : ?>
<div id="footer-widgets"><!--widget stuff--></div>
<?php endif; ?>
multiplier
Member
Posted 2 weeks ago #
That doesn't wrap all the widgets within the "footer-widgets" div, though. That's the main thing I'm trying to achieve.
Do they have to be wrapped in a single div or can they have individual divs?
multiplier
Member
Posted 2 weeks ago #
I want the entire widget region wrapped in one large div called "footer-widgets".
I think I've found it. Try:
<?php if( is_dynamic_sidebar() ) ?><div id="footer-widgets">
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Footer Widgets') ) : ?>
<!--widget stuff-->
<?php endif; ?>
<?php if( is_dynamic_sidebar() ) ?></div>
http://codex.wordpress.org/WordPress_Widgets_Api/is_dynamic_sidebar
multiplier
Member
Posted 2 weeks ago #
Thanks, but unfortunately that still leaves an empty "footer-widgets" div if no widgets are activated.
Any other ideas?
wereallyloveyou
Member
Posted 2 weeks ago #
This might help my question out too, thanks everyone! :)
EDIT: Nevermind, it did not do anything either.
multiplier
Member
Posted 2 weeks ago #
Anyone else know how to write the conditional properly?