Add custom sidebar

This commit is contained in:
Nilambar Sharma 2018-09-04 16:26:59 +05:45
parent 74a14ab03f
commit 0626ed4091
2 changed files with 40 additions and 0 deletions

View file

@ -19,6 +19,7 @@ define( 'ALX_EXTENSIONS_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
require_once ALX_EXTENSIONS_DIR . '/inc/share.php';
require_once ALX_EXTENSIONS_DIR . '/inc/post-formats.php';
require_once ALX_EXTENSIONS_DIR . '/inc/sidebar.php';
/* load plugin textdomain */
function alx_ext_load_textdomain() {

39
inc/sidebar.php Normal file
View file

@ -0,0 +1,39 @@
<?php
add_action( 'after_setup_theme', 'alx_ext_custom_sidebars', 11 );
function alx_ext_custom_sidebars() {
if ( ! class_exists( 'Kirki' ) ) {
return;
}
// Sidebars: Create Sidebars
Kirki::add_field( 'alx_theme', array(
'type' => 'repeater',
'label' => esc_html__( 'Create Sidebars', 'alx-extensions' ),
'description' => esc_html__( 'You must save and refresh the page to see your new sidebars.', 'alx-extensions' ),
'tooltip' => esc_html__( 'Make sure that you save and refresh the page if you can not see the sidebars you have created.', 'alx-extensions' ),
'section' => 'sidebars',
'row_label' => array(
'type' => 'text',
'value' => esc_html__('sidebar', 'alx-extensions' ),
),
'settings' => 'sidebar-areas',
'default' => '',
'fields' => array(
'title' => array(
'type' => 'text',
'label' => esc_html__( 'Sidebar Title', 'alx-extensions' ),
'description' => esc_html__( 'The widget box title', 'alx-extensions' ),
'default' => '',
),
'id' => array(
'type' => 'text',
'label' => esc_html__( 'Sidebar ID', 'alx-extensions' ),
'description' => esc_html__( 'This ID must be unique', 'alx-extensions' ),
'default' => 'sidebar-',
),
)
) );
}