mirror of
https://ghproxy.net/https://github.com/AlxMedia/alx-extensions.git
synced 2025-08-26 15:53:37 +08:00
Add custom sidebar
This commit is contained in:
parent
74a14ab03f
commit
0626ed4091
2 changed files with 40 additions and 0 deletions
|
@ -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
39
inc/sidebar.php
Normal 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-',
|
||||
),
|
||||
)
|
||||
) );
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue