Skip to content

Commit

Permalink
Remove closure from sidebar registration
Browse files Browse the repository at this point in the history
  • Loading branch information
QWp6t authored and retlehs committed Mar 11, 2016
1 parent d4461fa commit 12d6ac3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
<!-- Verify that operators have valid spacing surrounding them -->
<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"/>
</ruleset>
27 changes: 14 additions & 13 deletions src/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,18 @@
* Register sidebars
*/
add_action('widgets_init', function () {
$config = function ($name, $id = '') {
return [
'name' => __($name, 'sage'),
'id' => 'sidebar-' . $id ?: sanitize_title($name),
'before_widget' => '<section class="widget %1$s %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>'
];
};

register_sidebar($config('Primary'));
register_sidebar($config('Footer'));
$config = [
'before_widget' => '<section class="widget %1$s %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>'
];
register_sidebar([
'name' => __('Primary', 'sage'),
'id' => 'sidebar-primary'
] + $config);
register_sidebar([
'name' => __('Footer', 'sage'),
'id' => 'sidebar-footer'
] + $config);
});

0 comments on commit 12d6ac3

Please sign in to comment.