Reputation: 85
I'm trying to add items through widgets on wordpress, but the "dynamic_sidebar()" code is not working. Here's my code:
function templateWidgets(){
register_sidebar(array(
'name' => __('Header'),
'id' => 'headerSidebar'
));
}
add_action ('widgets_init', 'templateWidgets')
?>
and in my header file:
<?php if (is_active_sidebar('headerSidebar')) : ?>
<?php dynamic_sidebar('headerSidebar');?>
<?php endif; ?>
It should be working... the widget registers fine in the admin panel. If I use get_sidebar(), the page will show everything. But if I use dynamic_sidebar the code just gets ignored completely... I am using a local copy of wordpress through WAMP.
Please help! Thanks.
Upvotes: 2
Views: 830
Reputation: 85
Found a solution! :D id does not allow camel case (ie: header-sidebar instead of headerSidebar). I also had the problem of widgets not saving when updated in admin page. This solved that problem too. :)
Upvotes: 1