#2616 closed enhancement (worksforme)
Add a hook to unregister Sidebars in BP-Default from Child Theme functions.php
Reported by: | Bowromir | Owned by: | |
---|---|---|---|
Milestone: | 1.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | sidebar register, bp-default, child theme |
Cc: | Bowromir |
Description
I would like to see a hook added to the Parent Theme to allow Child Themes to deregister the Sidebar. The hook would be as follows:
/* Register the widget columns */ register_sidebars( array( 'name' => 'Sidebar', 'before_widget' => '<div id="widgetbox" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>' ) add_action( 'widgets_init', 'childtheme_sidebars' ); );
The sidebars can be added or removed with:
//functions.php im Child-Theme function unregister_sidebar() { unregister_sidebar('Sidebar'); } add_action( 'childtheme_sidebars', 'unregister_sidebar' )
This would make it easier to keep the widget area clean for the site admin.
Change History (6)
#3
@
14 years ago
I would expect that the call to unregister_sidebar in yor child theme's functions.php would work?
#5
@
14 years ago
- Resolution set to worksforme
- Status changed from new to closed
Actually, I take back that milestone change. Put the following in your child theme to unregister bp-default's sidebar:
function unregister_bp_sidebar() { unregister_sidebar( 'sidebar-1' ); } add_action( 'wp_head', 'unregister_bp_sidebar' );
I'm not entirely sure why it has to be hooked so late in the process ('wp_head') but it does.
Small typo made.. the first code should be: