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

	/*=========================================
	Sidebar Option  Section
	=========================================*/
	$wp_customize->add_section(
		'expert_videographer_sidebar_settings', array(
			'title' => esc_html__( 'Sidebar Options', 'expert-videographer' ),
			'priority' => 1,
			'panel' => 'expert_videographer_general',
		)
	);
	

	// Archive Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_videographer_archive_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_videographer_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_videographer_archive_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Archive Sidebar', 'expert-videographer' ),
			'section'     => 'expert_videographer_sidebar_settings',
			'settings'    => 'expert_videographer_archive_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Index Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_videographer_index_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_videographer_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_videographer_index_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Index Sidebar', 'expert-videographer' ),
			'section'     => 'expert_videographer_sidebar_settings',
			'settings'    => 'expert_videographer_index_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Pages Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_videographer_paged_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_videographer_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_videographer_paged_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Pages Sidebar', 'expert-videographer' ),
			'section'     => 'expert_videographer_sidebar_settings',
			'settings'    => 'expert_videographer_paged_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Search Result Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_videographer_search_result_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_videographer_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_videographer_search_result_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Search Result Sidebar', 'expert-videographer' ),
			'section'     => 'expert_videographer_sidebar_settings',
			'settings'    => 'expert_videographer_search_result_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Single Post Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_videographer_single_post_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_videographer_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_videographer_single_post_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Single Post Sidebar', 'expert-videographer' ),
			'section'     => 'expert_videographer_sidebar_settings',
			'settings'    => 'expert_videographer_single_post_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Sidebar Page Sidebar Date Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'expert_videographer_single_page_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'expert_videographer_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'expert_videographer_single_page_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Page Width Sidebar', 'expert-videographer' ),
			'section'     => 'expert_videographer_sidebar_settings',
			'settings'    => 'expert_videographer_single_page_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting( 'expert_videographer_sidebar_position', array(
        'default'   => 'right',
        'sanitize_callback' => 'expert_videographer_sanitize_sidebar_position',
    ));

    $wp_customize->add_control( 'expert_videographer_sidebar_position', array(
        'label'    => __( 'Sidebar Position', 'expert-videographer' ),
        'section'  => 'expert_videographer_sidebar_settings',
        'settings' => 'expert_videographer_sidebar_position',
        'type'     => 'radio',
        'choices'  => array(
            'right' => __( 'Right Sidebar', 'expert-videographer' ),
            'left'  => __( 'Left Sidebar', 'expert-videographer' ),
        ),
    ));

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

add_action( 'customize_register', 'expert_videographer_sidebar_setting' );