Don’t know if anyone is still having this problem, but I got the above code that chaoskaizer posted working by adding in && dynamic_sidebar(1) to the code, previously the if statement would never return false, causing the sidebar to display nothing, instead of displaying the code inside the else statement.
Sidebar code:
<?php
if ( function_exists('dynamic_sidebar')
&& dynamic_sidebar(1) && is_sidebar_active(1) ) {
// there is active widgets for sidebar-1
// do something
echo '<ul id="sidebar-1" class="xoxo">'.PHP_EOL;
dynamic_sidebar(1);
echo '</ul>'.PHP_EOL;
} else {
// no widget active for sidebar 1
// do custom sidebar stuff ...
}
?>
functions.php doesn’t need any further editing.