Remove closure from sidebar registration

This commit is contained in:
QWp6t
2015-12-27 16:44:51 -08:00
committed by Ben Word
parent d4461fa1e4
commit 12d6ac3c51
2 changed files with 15 additions and 14 deletions

View File

@@ -41,6 +41,6 @@
<!-- Verify that operators have valid spacing surrounding them --> <!-- Verify that operators have valid spacing surrounding them -->
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/> <rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
<!-- Force braces to be on the same lines in fuction declarations --> <!-- Force braces to be on the same lines in function declarations -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/> <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
</ruleset> </ruleset>

View File

@@ -69,17 +69,18 @@ add_action('after_setup_theme', function () {
* Register sidebars * Register sidebars
*/ */
add_action('widgets_init', function () { add_action('widgets_init', function () {
$config = function ($name, $id = '') { $config = [
return [
'name' => __($name, 'sage'),
'id' => 'sidebar-' . $id ?: sanitize_title($name),
'before_widget' => '<section class="widget %1$s %2$s">', 'before_widget' => '<section class="widget %1$s %2$s">',
'after_widget' => '</section>', 'after_widget' => '</section>',
'before_title' => '<h3>', 'before_title' => '<h3>',
'after_title' => '</h3>' 'after_title' => '</h3>'
]; ];
}; register_sidebar([
'name' => __('Primary', 'sage'),
register_sidebar($config('Primary')); 'id' => 'sidebar-primary'
register_sidebar($config('Footer')); ] + $config);
register_sidebar([
'name' => __('Footer', 'sage'),
'id' => 'sidebar-footer'
] + $config);
}); });