PHP code example of wpessential / wpessential-sidebars

1. Go to this page and download the library: Download wpessential/wpessential-sidebars library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wpessential / wpessential-sidebars example snippets


$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();

$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();

$sidebar = \WPEssential\Library\Sidebars::make();
$sidebar->remove('main-sidebar');
$sidebar->init();

$sidebar = \WPEssential\Library\Sidebars::make();
$sidebar->removes(['main-sidebar']);
$sidebar->init();