Sophia-After-Dark/inc/customizer/mt-customizer-general-panel...

125 lines
3.8 KiB
PHP

<?php
/**
* Sophia After Dark manage the Customizer options of general panel.
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_general_panels_sections_register' );
/**
* Add panels in the theme customizer
*
*/
function sophia_after_dark_customize_general_panels_sections_register( $wp_customize ) {
/*------------------------------------------- Site Settings Section -----------------------------------------------*/
/**
* Site Settings Section
*/
$wp_customize->add_section( 'sophia_after_dark_section_site',
array(
'priority' => 40,
'panel' => 'sophia_after_dark_general_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Site Settings', 'sophia-after-dark' )
)
);
/**
* Toggle field for Enable/Disable preloader.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_preloader',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_preloader',
array(
'label' => __( 'Enable Preloader', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_enable_preloader',
'priority' => 5,
)
)
);
/**
* Toggle field for Enable/Disable wow animation.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_wow_animation',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_wow_animation',
array(
'label' => __( 'Enable Wow Animation', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_enable_wow_animation',
'priority' => 10,
)
)
);
/**
* Radio image field for Archive Sidebar
*
* @since 1.0.0
*/
$wp_customize->add_setting( 'sophia_after_dark_site_layout',
array(
'default' => 'site-layout--wide',
'sanitize_callback' => 'sanitize_key',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
$wp_customize, 'sophia_after_dark_site_layout',
array(
'label' => __( 'Site Layout', 'sophia-after-dark' ),
'description' => __( 'Choose site layout from available layouts', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_site_layout',
'priority' => 15,
'choices' => array(
'site-layout--wide' => get_template_directory_uri() . '/assets/images/full-width.png',
'site-layout--boxed' => get_template_directory_uri() . '/assets/images/boxed-layout.png'
),
)
)
);
/**
* Toggle field for block based widget editor.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_widgets_editor',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_widgets_editor',
array(
'label' => __( 'Enable Widgets Editor', 'sophia-after-dark' ),
'description' => __( 'Enable/disable Block-based Widgets Editor(since WordPress 5.8).', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_enable_widgets_editor',
'priority' => 15,
)
)
);
}