I’m trying to wrap the sidebar by a DIV, and if the sidebar is empty the DIV should not be displayed
But i cannot use codes like
if(dynamic_sidebar(1))
{
echo '<div>';
dynamic_sidebar(1);
echo '</div>';
}
as it will load the sidebar before the DIV if it is not empty, any ideas?
You can always use output buffering. When output buffering is on, anything which would normally be echoed to the screen is instead stored in a buffer. You can then test to see if there is anything in the buffer before outputting your div tags.