https://github.com/wpessential/wpessential-sidebars
WPEssential Sidebars helping in registry of sidebars in WordPress.
https://github.com/wpessential/wpessential-sidebars
Last synced: 5 months ago
JSON representation
WPEssential Sidebars helping in registry of sidebars in WordPress.
- Host: GitHub
- URL: https://github.com/wpessential/wpessential-sidebars
- Owner: wpessential
- License: gpl-3.0
- Created: 2024-08-07T14:18:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-19T14:03:47.000Z (over 1 year ago)
- Last Synced: 2025-04-21T18:46:34.755Z (about 1 year ago)
- Language: PHP
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WPEssential Sidebars
Help to register the sidebars in WordPress.
`composer require wpessential/wpessential-sidebars`
Add the single sidebar to WordPress registry
```php
$sidebar = \WPEssential\Library\Sidebars::make();
$sidebar->add([
'id' =>'main-sidebar',
'name' => esc_html__( 'WPEssential: Main Sidebar', 'wpessential' ),
'description' => esc_html__( 'Widgets in this area will be shown on all posts and pages.', 'wpessential' ),
'title_tag' => 'h2'
]);
$sidebar->init();
```
Add the multiple sidebars to WordPress registry
```php
$sidebar = \WPEssential\Library\Sidebars::make();
$sidebar->adds([
'main-sidebar' => [
'name' => esc_html__( 'WPEssential: Main Sidebar', 'wpessential' ),
'description' => esc_html__( 'Widgets in this area will be shown on all posts and pages.', 'wpessential' ),
'title_tag' => 'h2'
]
]);
$sidebar->init();
```
Remove the single sidebar from WordPress registry
```php
$sidebar = \WPEssential\Library\Sidebars::make();
$sidebar->remove('main-sidebar');
$sidebar->init();
```
Remove the multiple sidebars from WordPress registry
```php
$sidebar = \WPEssential\Library\Sidebars::make();
$sidebar->removes(['main-sidebar']);
$sidebar->init();
```