which theme are you using?
link to your site?
Theme is still being developed. Not available online. But I am registering the following code for my sidebar:
register_sidebar(
array(
'name' => 'Sidebar',
'before_widget' => '<section class="widget widget-sidebar">',
'after_widget' => '</section>',
'before_title' => '<h1>',
'after_title' => '</h1>'
)
);
I need the H1 tags to be stripped when there is no content.
Having the same problem.
To remove the empty line and margin you could use the following workaround:
functions.php:
function widget_empty_title($output='') {
if ($output == '') {
return '<span class="empty"> </span>';
}
return $output;
}
add_filter('widget_title', 'widget_empty_title');
CSS:
.widget .empty {
display: block;
height: 1em;
margin-bottom: -2em; /* Assuming the h1 has a margin-bottom of 1em and the line-height is 1 */
}