make roots_register_sidebars() less redundant

This commit is contained in:
Michael Scott Hertzberg
2011-12-27 20:05:58 -05:00
parent 2b9f33430a
commit 94bb56b9f9

View File

@@ -74,26 +74,21 @@ add_action('after_setup_theme', 'roots_setup');
// hook into 'widgets_init' function with a lower priority in your // hook into 'widgets_init' function with a lower priority in your
// child theme to remove these sidebars // child theme to remove these sidebars
function roots_register_sidebars() { function roots_register_sidebars() {
register_sidebar( $sidebars = array( 'Sidebar', 'Footer' );
array(
'id'=> 'roots-sidebar', foreach( $sidebars as $sidebar ) {
'name' => __('Sidebar', 'roots'), register_sidebar(
'description' => __('Sidebar', 'roots'), array(
'before_widget' => '<article id="%1$s" class="widget %2$s"><div class="container">', 'id'=> 'roots-' . strtolower( $sidebar ),
'after_widget' => '</div></article>', 'name' => __( $sidebar, 'roots' ),
'before_title' => '<h3>', 'description' => __( $sidebar, 'roots' ),
'after_title' => '</h3>' 'before_widget' => '<article id="%1$s" class="widget %2$s"><div class="container">',
)); 'after_widget' => '</div></article>',
register_sidebar( 'before_title' => '<h3>',
array( 'after_title' => '</h3>'
'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'); add_action('widgets_init', 'roots_register_sidebars');