I currently am using a child theme, and its parent theme has registered sidebars already..
My. problem is that i want to change the parent theme’s dynamic sidebar
From:
register_sidebar(array(
'name' => 'Footer',
'before_widget' => '<div class="span3">',
'after_widget' => '</div>',
'before_title' => '<h6 style="text-transform: uppercase !important; font-weight:600; !important">',
'after_title' => '</h6><hr>',
));
To:
register_sidebar(array(
'name' => 'Footer',
'before_widget' => '<div class="span3">',
'after_widget' => '</div>',
'before_title' => '<h6 class="footer-widget-item">',
'after_title' => '</h6><hr>',
));
Now, how am I supposed to do that? I have found this hook called after_setup_theme from here but I’m a bit confused on how to do it. Should I deregister the sidebar then register it again?
UPDATE:
Here is my attempt but it didn’t work:
add_action( 'after_setup_theme', 'parent_override' );
function parent_override() {
unregister_sidebar('Footer');
register_sidebar(array(
'name' => 'Footer',
'before_widget' => '<div class="span3">',
'after_widget' => '</div>',
'before_title' => '<h6 class="footer-widgets-item">',
'after_title' => '</h6><hr>',
));
}
Here is what worked:
It seems that the id is not a slug of the name, and if you did not specify an id upon registering the sidebar, it will have an id of “sidebar-#”…