diff --git a/functions.php b/functions.php index 25c81d1..9e27764 100644 --- a/functions.php +++ b/functions.php @@ -74,26 +74,21 @@ add_action('after_setup_theme', 'roots_setup'); // 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' => '
', - 'after_widget' => '
', - 'before_title' => '

', - 'after_title' => '

' - )); - register_sidebar( - array( - 'id'=> 'roots-footer', - 'name' => __('Footer', 'roots'), - 'description' => __('Footer', 'roots'), - 'before_widget' => '
', - 'after_widget' => '
', - 'before_title' => '

', - 'after_title' => '

' - )); + $sidebars = array( 'Sidebar', 'Footer' ); + + foreach( $sidebars as $sidebar ) { + register_sidebar( + array( + 'id'=> 'roots-' . strtolower( $sidebar ), + 'name' => __( $sidebar, 'roots' ), + 'description' => __( $sidebar, 'roots' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

' + ) + ); + } } add_action('widgets_init', 'roots_register_sidebars');