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"> <footer id="content-info" class="<?php global $roots_options; echo $roots_options['container_class']; ?>" role="contentinfo">
<?php roots_footer_inside(); ?> <?php roots_footer_inside(); ?>
<div class="container"> <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> <p class="copy"><small>&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?></small></p>
</div> </div>
</footer> </footer>

View File

@@ -65,17 +65,36 @@ function roots_setup() {
add_action('after_setup_theme', 'roots_setup'); add_action('after_setup_theme', 'roots_setup');
// create widget areas: sidebar, footer /**
$sidebars = array('Sidebar', 'Footer'); * Register default roots sidebars.
foreach ($sidebars as $sidebar) { * Hook into 'widgets_init' function with a lower priority in your child
register_sidebar(array('name'=> $sidebar, * theme to remove these sidebars.
'before_widget' => '<article id="%1$s" class="widget %2$s"><div class="container">', */
'after_widget' => '</div></article>', function roots_register_sidebars() {
'before_title' => '<h3>', register_sidebar(
'after_title' => '</h3>' 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>',
'after_title' => '</h3>'
));
} }
add_action( 'widgets_init', 'roots_register_sidebars' );
// return post entry meta information // return post entry meta information
function roots_entry_meta() { 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>'; 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'); ?>