<?php
function expert_life_coach_sidebar_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
	$wp_customize->add_panel(
		'expert_life_coach_sidebar', array(
			'priority' => 31,
			'title' => esc_html__( 'Sidebar Options', 'expert-life-coach' ),
		)
	);

	/*=========================================
	Sidebar Option  Section
	=========================================*/
	$wp_customize->add_section(
		'expert_life_coach_sidebar_settings', array(
			'title' => esc_html__( 'Sidebar Options', 'expert-life-coach' ),
			'priority' => 1,
			'panel' => 'expert_life_coach_general',
		)
	);
	

	// Archive Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_life_coach_archive_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_life_coach_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_life_coach_archive_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Archive Sidebar', 'expert-life-coach' ),
			'section'     => 'expert_life_coach_sidebar_settings',
			'settings'    => 'expert_life_coach_archive_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Index Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_life_coach_index_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_life_coach_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_life_coach_index_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Index Sidebar', 'expert-life-coach' ),
			'section'     => 'expert_life_coach_sidebar_settings',
			'settings'    => 'expert_life_coach_index_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Pages Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_life_coach_paged_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_life_coach_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_life_coach_paged_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Pages Sidebar', 'expert-life-coach' ),
			'section'     => 'expert_life_coach_sidebar_settings',
			'settings'    => 'expert_life_coach_paged_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Search Result Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_life_coach_search_result_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_life_coach_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_life_coach_search_result_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Search Result Sidebar', 'expert-life-coach' ),
			'section'     => 'expert_life_coach_sidebar_settings',
			'settings'    => 'expert_life_coach_search_result_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Single Post Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_life_coach_single_post_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_life_coach_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_life_coach_single_post_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Single Post Sidebar', 'expert-life-coach' ),
			'section'     => 'expert_life_coach_sidebar_settings',
			'settings'    => 'expert_life_coach_single_post_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Sidebar Page Sidebar Date Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_life_coach_single_page_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_life_coach_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_life_coach_single_page_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Page Width Sidebar', 'expert-life-coach' ),
			'section'     => 'expert_life_coach_sidebar_settings',
			'settings'    => 'expert_life_coach_single_page_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting( 'expert_life_coach_sidebar_position', array(
        'default'   => 'right',
        'sanitize_callback' => 'expert_life_coach_sanitize_sidebar_position',
    ));

    $wp_customize->add_control( 'expert_life_coach_sidebar_position', array(
        'label'    => __( 'Sidebar Position', 'expert-life-coach' ),
        'section'  => 'expert_life_coach_sidebar_settings',
        'settings' => 'expert_life_coach_sidebar_position',
        'type'     => 'radio',
        'choices'  => array(
            'right' => __( 'Right Sidebar', 'expert-life-coach' ),
            'left'  => __( 'Left Sidebar', 'expert-life-coach' ),
        ),
    ));

	 $wp_customize->add_setting( 'expert_life_coach_upgrade_page_settings_15',
        array(
            'sanitize_callback' => 'sanitize_text_field'
        )
    );
    $wp_customize->add_control( new Expert_Life_Coach_Control_Upgrade(
        $wp_customize, 'expert_life_coach_upgrade_page_settings_15',
            array(
                'priority'      => 200,
                'section'       => 'expert_life_coach_sidebar_settings',
                'settings'      => 'expert_life_coach_upgrade_page_settings_15',
                'label'         => __( 'Expert Life Coach Pro comes with additional features.', 'expert-life-coach' ),
                'choices'       => array( __( '15+ Ready-Made Sections', 'expert-life-coach' ), __( 'One-Click Demo Import', 'expert-life-coach' ), __( 'WooCommerce Integrated', 'expert-life-coach' ), __( 'Drag & Drop Section Reordering', 'expert-life-coach' ),__( 'Advanced Typography Control', 'expert-life-coach' ),__( 'Intuitive Customization Options', 'expert-life-coach' ),__( '24/7 Support', 'expert-life-coach' ), )
            )
        )
    ); 
}

add_action( 'customize_register', 'expert_life_coach_sidebar_setting' );