Fix register sidebars so child themes can unregister them.

This commit is contained in:
Johnny Peck
2011-11-04 16:36:14 -04:00
parent 38890bf3b3
commit a2d33c7fd9
3 changed files with 30 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
<footer id="content-info" class="<?php global $roots_options; echo $roots_options['container_class']; ?>" role="contentinfo">
<?php roots_footer_inside(); ?>
<div class="container">
<?php dynamic_sidebar("Footer"); ?>
<?php dynamic_sidebar('roots-footer'); ?>
<p class="copy"><small>&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?></small></p>
</div>
</footer>

View File

@@ -65,10 +65,27 @@ function roots_setup() {
add_action('after_setup_theme', 'roots_setup');
// create widget areas: sidebar, footer
$sidebars = array('Sidebar', 'Footer');
foreach ($sidebars as $sidebar) {
register_sidebar(array('name'=> $sidebar,
/**
* Register default roots sidebars.
* Hook into 'widgets_init' function with a lower priority in your child
* theme to remove these sidebars.
*/
function roots_register_sidebars() {
register_sidebar(
array(
'id'=> 'roots-sidebar',
'name' => __('Sidebar', 'roots'),
'description' => __('Sidebar', 'roots'),
'before_widget' => '<article id="%1$s" class="widget %2$s"><div class="container">',
'after_widget' => '</div></article>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
register_sidebar(
array(
'id'=> 'roots-footer',
'name' => __('Footer', 'roots'),
'description' => __('Footer', 'roots'),
'before_widget' => '<article id="%1$s" class="widget %2$s"><div class="container">',
'after_widget' => '</div></article>',
'before_title' => '<h3>',
@@ -76,6 +93,8 @@ foreach ($sidebars as $sidebar) {
));
}
add_action( 'widgets_init', 'roots_register_sidebars' );
// return post entry meta information
function roots_entry_meta() {
echo '<time class="updated" datetime="'. get_the_time('c') .'" pubdate>'. sprintf(__('Posted on %s at %s.', 'roots'), get_the_time('l, F jS, Y'), get_the_time()) .'</time>';

View File

@@ -1 +1 @@
<?php dynamic_sidebar("Sidebar"); ?>
<?php dynamic_sidebar('roots-sidebar'); ?>