<?php
function onlinejewelrystore_blog_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
	$wp_customize->add_panel(
		'onlinejewelrystore_frontpage_sections', array(
			'priority' => 32,
			'title' => esc_html__( 'Frontpage Sections', 'online-jewelry-store' ),
		)
	);
	
 
	/*=========================================
	Slider Section
	=========================================*/
	$wp_customize->add_section(
		'slider_setting', array(
			'title' => esc_html__( 'Slider Section', 'online-jewelry-store' ),
			'description'=> __('<a>Note :</a> Image Size Should Be 1500*800','online-jewelry-store'),
			'priority' => 1,
			'panel' => 'onlinejewelrystore_frontpage_sections',
		)
	);


	$wp_customize->add_setting('onlinejewelrystore_slider_tabs', array(
	   'sanitize_callback' => 'wp_kses_post',
	));

	$wp_customize->add_control(new onlinejewelrystore_Tab_Control($wp_customize, 'onlinejewelrystore_slider_tabs', array(
	   'section' => 'slider_setting',
	   'priority' => 2,
	   'buttons' => array(
	      array(
         	'name' => esc_html__('General', 'online-jewelry-store'),
            'icon' => 'dashicons dashicons-welcome-write-blog',
            'fields' => array(
            	'slider1',
            	'slider2',
            	'slider3',
            	'slider4',
            	'slider5',
            	'slider6',
				'slider_btnlink'
            ),
            'active' => true,
         ), 
	      array(
            'name' => esc_html__('Style', 'online-jewelry-store'),
        	'icon' => 'dashicons dashicons-art',
            'fields' => array(
                'slider_titlecolor',
                'slider_descriptioncolor',
				'slider_bordercolor',
                'slider_btntxt1color',
				'slider_btntxthrvcolor',
				'slider_downarrowcolor',
				'slider_downarrowHovercolor',
				'slider_downarrowbgcolor'
            ),
     	)
	    
    	),
	))); 


	

	// General Tab

	// Slider 1
	$wp_customize->add_setting( 
    	'slider1',
    	array(
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider1',
		array(
		    'label'   		=> __('Slider 1','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'dropdown-pages',
			'transport'         => $selective_refresh,
		)  
	);		



	// Slider 2
	$wp_customize->add_setting(
    	'slider2',
    	array(
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 4,
		)
	);	

	$wp_customize->add_control( 
		'slider2',
		array(
		    'label'   		=> __('Slider 2','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'dropdown-pages',
			'transport'         => $selective_refresh,
		)  
	);	


	// Slider 3
	$wp_customize->add_setting(
    	'slider3',
    	array(
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 5,
		)
	);	

	$wp_customize->add_control( 
		'slider3',
		array(
		    'label'   		=> __('Slider 3','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'dropdown-pages',
			'transport'         => $selective_refresh,
		)  
	);	


	// Slider 4
	$wp_customize->add_setting(
    	'slider4',
    	array(
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 6,
		)
	);	

	$wp_customize->add_control( 
		'slider4',
		array(
		    'label'   		=> __('Slider 4','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'dropdown-pages',
			'transport'         => $selective_refresh,
		)  
	);



	// Slider 5
	$wp_customize->add_setting(
    	'slider5',
    	array(
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 7,
		)
	);	

	$wp_customize->add_control( 
		'slider5',
		array(
		    'label'   		=> __('Slider 5','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'dropdown-pages',
			'transport'         => $selective_refresh,
		)  
	);

	// Slider 6
	$wp_customize->add_setting(
    	'slider6',
    	array(
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 7,
		)
	);	

	$wp_customize->add_control( 
		'slider6',
		array(
		    'label'   		=> __('Slider 6','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'dropdown-pages',
			'transport'         => $selective_refresh,
		)  
	);

	// slider btnlink
	$wp_customize->add_setting(
    	'slider_btnlink',
    	array(
			'default' => '',
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 6,
		)
	);	

	$wp_customize->add_control( 
		'slider_btnlink',
		array(
		    'label'   		=> __('Button Link','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'text',
			'transport'         => $selective_refresh,
		)  
	);



	// Style setting

	// slider title Color
	$slidertitlecolor = esc_html__('#fff', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_titlecolor',
    	array(
			'default' => $slidertitlecolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_titlecolor',
		array(
		    'label'   		=> __('Title Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);


	// slider description Color
	$sliderdescriptioncolor = esc_html__('#fff', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_descriptioncolor',
    	array(
			'default' => $sliderdescriptioncolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_descriptioncolor',
		array(
		    'label'   		=> __('Description Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// slider border Color
	$sliderbordercolor = esc_html__('#fff', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_bordercolor',
    	array(
			'default' => $sliderbordercolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_bordercolor',
		array(
		    'label'   		=> __('Border Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// slider btntxt1 Color
	$sliderbtntxt1color = esc_html__('#fff', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_btntxt1color',
    	array(
			'default' => $sliderbtntxt1color,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_btntxt1color',
		array(
		    'label'   		=> __('Button Text Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// slider btntxthrv Color
	$sliderbtntxthrvcolor = esc_html__('#C80000', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_btntxthrvcolor',
    	array(
			'default' => $sliderbtntxthrvcolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_btntxthrvcolor',
		array(
		    'label'   		=> __('Button Text Hover Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// slider downarrow Color
	$sliderdownarrowcolor = esc_html__('#000', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_downarrowcolor',
    	array(
			'default' => $sliderdownarrowcolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_downarrowcolor',
		array(
		    'label'   		=> __('Down Arrow Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);


		// slider downarrow Hover Color
	$sliderdownarrowHovercolor = esc_html__('#521717', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_downarrowHovercolor',
    	array(
			'default' => $sliderdownarrowHovercolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_downarrowHovercolor',
		array(
		    'label'   		=> __('Down Arrow Hover Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// slider downarrowbg Color
	$sliderdownarrowbgcolor = esc_html__('#fff', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'slider_downarrowbgcolor',
    	array(
			'default' => $sliderdownarrowbgcolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'slider_downarrowbgcolor',
		array(
		    'label'   		=> __('Down Arrow BG Color','online-jewelry-store'),
		    'section'		=> 'slider_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	
	
	/*=========================================
	collection Section
	=========================================*/
	$wp_customize->add_section(
		'collection_setting', array(
			'title' => esc_html__( 'Collection Section', 'online-jewelry-store' ),
			'description'=> __('<a>Note :</a> Image Size Should Be 196*230','online-jewelry-store'),
			'priority' => 1,
			'panel' => 'onlinejewelrystore_frontpage_sections',
		)
	);



	$wp_customize->add_setting('onlinejewelrystore_collection_tabs', array(
	   'sanitize_callback' => 'wp_kses_post',
	));

	$wp_customize->add_control(new onlinejewelrystore_Tab_Control($wp_customize, 'onlinejewelrystore_collection_tabs', array(
	   'section' => 'collection_setting',
	   'priority' => 2,
	   'buttons' => array(
	      array(
         	'name' => esc_html__('General', 'online-jewelry-store'),
            'icon' => 'dashicons dashicons-welcome-write-blog',
            'fields' => array(
				'collection_disable_section',
            	'collection_heading'
            ),
            'active' => true,
         ), 
	      array(
            'name' => esc_html__('Style', 'online-jewelry-store'),
        	'icon' => 'dashicons dashicons-art',
            'fields' => array(
                'collection_headingcolor',
				'collection_titlecolor',
				'collection_titlebgcolor'
            ),
     	)
    	),
	))); 


	// General Tab

	// hide show collection section
	$wp_customize->add_setting(
        'collection_disable_section',
        array(
            'sanitize_callback' => 'wp_kses_post',
        )
    ); 
    $wp_customize->add_control(
        new onlinejewelrystore_Toggle_Switch_Custom_Control(
            $wp_customize,
            'collection_disable_section',
            array(
                'settings'      => 'collection_disable_section',
                'section'       => 'collection_setting',
                'label'         => __( 'Disable Section', 'online-jewelry-store' ),
                'on_off_label'  => array(
                    'on' => __( 'Yes', 'online-jewelry-store' ),
                    'off' => __( 'No', 'online-jewelry-store' )
                ),
            )
        )
    );

	// collection heading
	$collectionheading = esc_html__('', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'collection_heading',
    	array(
			'default' => $collectionheading,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 6,
		)
	);	

	$wp_customize->add_control( 
		'collection_heading',
		array(
		    'label'   		=> __('Collection Heading','online-jewelry-store'),
		    'section'		=> 'collection_setting',
			'type' 			=> 'text',
			'transport'         => $selective_refresh,
		)  
	);	


	//style
	// collection heading Color 
	$collectionheadingcolor = esc_html__('#000', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'collection_headingcolor',
    	array(
			'default' => $collectionheadingcolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'collection_headingcolor',
		array(
		    'label'   		=> __('Heading Color','online-jewelry-store'),
		    'section'		=> 'collection_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// collection title Color 
	$collectiontitlecolor = esc_html__('#fff', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'collection_titlecolor',
    	array(
			'default' => $collectiontitlecolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'collection_titlecolor',
		array(
		    'label'   		=> __('Title Color','online-jewelry-store'),
		    'section'		=> 'collection_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// collection titlebg Color 
	$collectiontitlebgcolor = esc_html__('#000', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'collection_titlebgcolor',
    	array(
			'default' => $collectiontitlebgcolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'collection_titlebgcolor',
		array(
		    'label'   		=> __('Title BG Color','online-jewelry-store'),
		    'section'		=> 'collection_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);


	/*=========================================
	featured Section
	=========================================*/
	$wp_customize->add_section(
		'featured_setting', array(
			'title' => esc_html__( 'Featured Product Section', 'online-jewelry-store' ),
			'description'=> __('<a>Note :</a> Image Size Should Be 285*285','online-jewelry-store'),
			'priority' => 1,
			'panel' => 'onlinejewelrystore_frontpage_sections',
		)
	);


	$wp_customize->add_setting('onlinejewelrystore_featured_tabs', array(
	   'sanitize_callback' => 'wp_kses_post',
	));

	$wp_customize->add_control(new onlinejewelrystore_Tab_Control($wp_customize, 'onlinejewelrystore_featured_tabs', array(
	   'section' => 'featured_setting',
	   'priority' => 2,
	   'buttons' => array(
	      array(
         	'name' => esc_html__('General', 'online-jewelry-store'),
            'icon' => 'dashicons dashicons-welcome-write-blog',
            'fields' => array(
				'feature_disable_section',
            	'featured_heading'
            ),
            'active' => true,
         ), 
	      array(
            'name' => esc_html__('Style', 'online-jewelry-store'),
        	'icon' => 'dashicons dashicons-art',
            'fields' => array(
                'featured_headingcolor',
				'featured_titlecolor',
				'featured_salepricecolor'
            ),
     	)

    	),
	))); 


	// General Tab

	// hide show feature section
	$wp_customize->add_setting(
        'feature_disable_section',
        array(
            'sanitize_callback' => 'wp_kses_post',
        )
    ); 
    $wp_customize->add_control(
        new onlinejewelrystore_Toggle_Switch_Custom_Control(
            $wp_customize,
            'feature_disable_section',
            array(
                'settings'      => 'feature_disable_section',
                'section'       => 'featured_setting',
                'label'         => __( 'Disable Section', 'online-jewelry-store' ),
                'on_off_label'  => array(
                    'on' => __( 'Yes', 'online-jewelry-store' ),
                    'off' => __( 'No', 'online-jewelry-store' )
                ),
            )
        )
    );

	// featured heading
	$featuredheading = esc_html__('', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'featured_heading',
    	array(
			'default' => $featuredheading,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 6,
		)
	);	

	$wp_customize->add_control( 
		'featured_heading',
		array(
		    'label'   		=> __('Heading','online-jewelry-store'),
		    'section'		=> 'featured_setting',
			'type' 			=> 'text',
			'transport'         => $selective_refresh,
		)  
	);	


	//style
	// featured heading Color 
	$featuredheadingcolor = esc_html__('#000', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'featured_headingcolor',
    	array(
			'default' => $featuredheadingcolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'featured_headingcolor',
		array(
		    'label'   		=> __('Featured Heading Color','online-jewelry-store'),
		    'section'		=> 'featured_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);


	// featured title Color 
	$featuredtitlecolor = esc_html__('#000', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'featured_titlecolor',
    	array(
			'default' => $featuredtitlecolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'featured_titlecolor',
		array(
		    'label'   		=> __('Product Title Color','online-jewelry-store'),
		    'section'		=> 'featured_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);

	// featured saleprice Color 
	$featuredsalepricecolor = esc_html__('#000', 'online-jewelry-store' );
	$wp_customize->add_setting(
    	'featured_salepricecolor',
    	array(
			'default' => $featuredsalepricecolor,
			'capability'     	=> 'edit_theme_options',
			'sanitize_callback' => 'wp_kses_post',
			'priority'      => 3,
		)
	);	

	$wp_customize->add_control( 
		'featured_salepricecolor',
		array(
		    'label'   		=> __('Product Price Color','online-jewelry-store'),
		    'section'		=> 'featured_setting',
			'type' 			=> 'color',
			'transport'         => $selective_refresh,
		)  
	);


	$wp_customize->register_control_type('onlinejewelrystore_Tab_Control');

}

add_action( 'customize_register', 'onlinejewelrystore_blog_setting' );

// service selective refresh
function onlinejewelrystore_blog_section_partials( $wp_customize ){	
	// blog_title
	$wp_customize->selective_refresh->add_partial( 'blog_title', array(
		'selector'            => '.home-blog .title h6',
		'settings'            => 'blog_title',
		'render_callback'  => 'onlinejewelrystore_blog_title_render_callback',
	
	) );
	
	// blog_subtitle
	$wp_customize->selective_refresh->add_partial( 'blog_subtitle', array(
		'selector'            => '.home-blog .title h2',
		'settings'            => 'blog_subtitle',
		'render_callback'  => 'onlinejewelrystore_blog_subtitle_render_callback',
	
	) );
	
	// blog_description
	$wp_customize->selective_refresh->add_partial( 'blog_description', array(
		'selector'            => '.home-blog .title p',
		'settings'            => 'blog_description',
		'render_callback'  => 'onlinejewelrystore_blog_description_render_callback',
	
	) );	
	}

add_action( 'customize_register', 'onlinejewelrystore_blog_section_partials' );

// blog_title
function onlinejewelrystore_blog_title_render_callback() {
	return get_theme_mod( 'blog_title' );
}

// blog_subtitle
function onlinejewelrystore_blog_subtitle_render_callback() {
	return get_theme_mod( 'blog_subtitle' );
}

// service description
function onlinejewelrystore_blog_description_render_callback() {
	return get_theme_mod( 'blog_description' );
}


