28 lines
1.1 KiB
PHP
28 lines
1.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
defined('ABSPATH') || exit;
|
|
|
|
add_action('widgets_init', 'xshop_register_sidebars');
|
|
|
|
function xshop_register_sidebars(): void {
|
|
$sidebars = [
|
|
['id'=>'sidebar-main','name'=>__('Main Sidebar','xshop'),'desc'=>__('Appears on blog and pages.','xshop')],
|
|
['id'=>'sidebar-shop','name'=>__('Shop Sidebar','xshop'),'desc'=>__('Appears on shop archives.','xshop')],
|
|
['id'=>'footer-1','name'=>__('Footer Column 1','xshop'),'desc'=>''],
|
|
['id'=>'footer-2','name'=>__('Footer Column 2','xshop'),'desc'=>''],
|
|
['id'=>'footer-3','name'=>__('Footer Column 3','xshop'),'desc'=>''],
|
|
['id'=>'footer-4','name'=>__('Footer Column 4','xshop'),'desc'=>''],
|
|
];
|
|
foreach ($sidebars as $s) {
|
|
register_sidebar([
|
|
'name' => $s['name'],
|
|
'id' => $s['id'],
|
|
'description' => $s['desc'],
|
|
'before_widget' => '<section id="%1$s" class="xshop-widget %2$s">',
|
|
'after_widget' => '</section>',
|
|
'before_title' => '<h3 class="xshop-widget__title">',
|
|
'after_title' => '</h3>',
|
|
]);
|
|
}
|
|
}
|