I'm working with a handy responsive theme framework (Reverie) and I'm developing my own theme the right way using a Child theme. The Parent theme calls a sidebar called with an ID of 'Footer' and applies some basic styles to it. I want to adjust this in my child theme, so I was looking at perhaps filtering it but in the end I decided it'd probably be easiest to unregister the sidebar and re-register a new one with the proper classes in childtheme's functions.php.
Here's the code from the parent theme which declares the sidebar
$sidebars = array('Footer');
foreach ($sidebars as $sidebar) {
register_sidebar(array('name'=> $sidebar,
'id' => 'Footer',
'before_widget' => '<div class="large-3 columns"><article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article></div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
Yet, I'm not able to de-register the sidebar. I've attempted it, with the code below, but without any luck..
// Unregisters Reverie footer sidebar
function remove_footer(){
unregister_sidebar( 'Footer' );
}
add_action ('widgets_init, remove_footer', 11);
// Registers new footer array with proper classes
$sidebars = array('Childfeet');
foreach ($sidebars as $sidebar) {
register_sidebar(array('name'=> $sidebar,
'id' => 'Childfeet',
'before_widget' => '<div class="small-12 medium-6 large-3 columns"><article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article></div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
My new sidebar with proper classes is of course created, but it seems like my remove_footer() does not do it's job. Any ideas?
I have checked out all the other 'unregistering sidebar' posts here in the forums, but these all contain errors in functions which I can't see in my code.
Thanks a bunch for your time!
_doing_it_wrong()
by calling the sidebar directly fromfunctions.php
instead of defining them in a function and calling them via thewidgets-init
hook. If that's the case then unregistering via thewidgets-init
hook isn't going to work. I'm not sure if trying a different hook for your removal function (after_setup_theme
, maybe?) would work, and even if it did, the whole thing would be highly unorthodox and may result in other problems down the road, so proceed with caution!