In my custom theme's function.php
file, I have created a widget area:
function my_footer_widget_area() {
$args = array(
'id' => 'footer_widget_area',
'class' => 'my_widget_footer',
'name' => __('Footer Widget Area', 'mynamespace'),
'description' => __('Widgets for the footer. The widget title will appear above the widget content. Leave the title blank to only display widget content.', 'mynamespace'),
);
register_sidebar($args);
}
Which is activated with
add_action('widgets_init', 'my_footer_widget_area');
The theme's sidebar.php
file contains
if (is_active_sidebar('footer_widget_area')): ?>
<div id="tertiary" class="footer-container" role="complementary">
<div class="footer-inner">
<div class="widget-area">
<?php dynamic_sidebar('footer_widget_area');?>
</div><!-- .widget-area -->
</div><!-- .footer-inner -->
</div><!-- #tertiary -->
<?php else: ?>
<!-- Time to add some widgets! -->
<div id="tertiary" class="footer-container" role="complementary">
<div class="footer-inner">
<div class="widget-area">
<!-- <p>footer sidebar - not active</p> -->
</div>
</div>
</div>
<?php endif;
When the theme is activated, the widget area is active, but the widget area contains widgets.
How do I create the widget area with no widgets in that widget area? Are there default widgets assigned to a created widget area? If so, how do I disable those default widgets?
id
(footer_widget_area
), and those widgets were added to that widgets area? And remember that a plugin could also register a widget area with the sameid
. Have you checked those aspects and tried clearing your caches?