<?php
/**
 * Automotive Parts Theme Customizer
 *
 * @package Automotive Parts
 */

function Automotive_Parts_Customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';

	if ( isset( $wp_customize->selective_refresh ) ) {
		$wp_customize->selective_refresh->add_partial(
			'blogname',
			array(
				'selector'        => '.site-title a',
				'render_callback' => 'Automotive_Parts_Customize_partial_blogname',
			)
		);
		$wp_customize->selective_refresh->add_partial(
			'blogdescription',
			array(
				'selector'        => '.site-description',
				'render_callback' => 'Automotive_Parts_Customize_partial_blogdescription',
			)
		);
	}

	/*
    * Theme Options Panel
    */
	$wp_customize->add_panel('automotive_parts_panel', array(
		'priority' => 25,
		'capability' => 'edit_theme_options',
		'title' => __('Automotive Parts Theme Options', 'automotive-parts'),
	));

	/*
	* Customizer main header section
	*/

	$wp_customize->add_setting(
		'automotive_parts_site_title_text',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_site_title_text',
		array(
			'label'       => __('Enable Title', 'automotive-parts'),
			'description' => __('Enable or Disable Title from the site', 'automotive-parts'),
			'section'     => 'title_tagline',
			'type'        => 'checkbox',
		)
	);

	$wp_customize->add_setting(
		'automotive_parts_site_tagline_text',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 0,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_site_tagline_text',
		array(
			'label'       => __('Enable Tagline', 'automotive-parts'),
			'description' => __('Enable or Disable Tagline from the site', 'automotive-parts'),
			'section'     => 'title_tagline',
			'type'        => 'checkbox',
		)
	);

		$wp_customize->add_setting(
		'automotive_parts_logo_width',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '150',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_logo_width',
		array(
			'label'       => __('Logo Width in PX', 'automotive-parts'),
			'section'     => 'title_tagline',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 100,
	             'max' => 300,
	             'step' => 1,
	         ),
		)
	);

	/* WooCommerce custom settings */

	$wp_customize->add_section('woocommerce_custom_settings', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('WooCommerce Custom Settings', 'automotive-parts'),
		'panel'       => 'woocommerce',
	));

	$wp_customize->add_setting(
		'automotive_parts_per_columns',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '3',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_per_columns',
		array(
			'label'       => __('Product Per Single Row', 'automotive-parts'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 4,
	             'step' => 1,
	         ),
		)
	);

	$wp_customize->add_setting(
		'automotive_parts_product_per_page',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '6',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_product_per_page',
		array(
			'label'       => __('Product Per One Page', 'automotive-parts'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 12,
	             'step' => 1,
	         ),
		)
	);

	/*Related Products Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_related_product',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_related_product',
		array(
			'label'       => __('Enable Related Product', 'automotive-parts'),
			'description' => __('Checked to show Related Product', 'automotive-parts'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'checkbox',
		)
	);

	$wp_customize->add_setting(
		'custom_related_products_number',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '3',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'custom_related_products_number',
		array(
			'label'       => __('Related Product Count', 'automotive-parts'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 20,
	             'step' => 1,
	         ),
		)
	);

	$wp_customize->add_setting(
		'custom_related_products_number_per_row',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '3',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'custom_related_products_number_per_row',
		array(
			'label'       => __('Related Product Per Row', 'automotive-parts'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 4,
	             'step' => 1,
	         ),
		)
	);

	/*Archive Product layout*/
	$wp_customize->add_setting('automotive_parts_archive_product_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
	));
	$wp_customize->add_control('automotive_parts_archive_product_layout',array(
        'type' => 'select',
        'label' => esc_html__('Archive Product Layout','automotive-parts'),
        'section' => 'woocommerce_custom_settings',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','automotive-parts'),
            'layout-2' => esc_html__('Sidebar On Left','automotive-parts'),
			'layout-3' => esc_html__('Full Width Layout','automotive-parts')
        ),
	) );

	/*Single Product layout*/
	$wp_customize->add_setting('automotive_parts_single_product_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
	));
	$wp_customize->add_control('automotive_parts_single_product_layout',array(
        'type' => 'select',
        'label' => esc_html__('Single Product Layout','automotive-parts'),
        'section' => 'woocommerce_custom_settings',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','automotive-parts'),
            'layout-2' => esc_html__('Sidebar On Left','automotive-parts'),
			'layout-3' => esc_html__('Full Width Layout','automotive-parts')
        ),
	) );

	$wp_customize->add_setting('automotive_parts_woocommerce_product_sale',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
        'default'           => 'Right',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
    ));
    $wp_customize->add_control('automotive_parts_woocommerce_product_sale',array(
        'label'       => esc_html__( 'Woocommerce Product Sale Positions','automotive-parts' ),
        'type' => 'select',
        'section' => 'woocommerce_custom_settings',
        'choices' => array(
            'Right' => __('Right','automotive-parts'),
            'Left' => __('Left','automotive-parts'),
            'Center' => __('Center','automotive-parts')
        ),
    ) );

	/*Additional Options*/
	$wp_customize->add_section('automotive_parts_additional_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('Additional Options', 'automotive-parts'),
		'panel'       => 'automotive_parts_panel',
	));

	/*Main Slider Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_sticky_header',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => false,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_sticky_header',
		array(
			'label'       => __('Enable Sticky Header', 'automotive-parts'),
			'description' => __('Checked to enable sticky header', 'automotive-parts'),
			'section'     => 'automotive_parts_additional_section',
			'type'        => 'checkbox',
		)
	);

	/*Main Slider Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_preloader',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 0,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_preloader',
		array(
			'label'       => __('Enable Preloader', 'automotive-parts'),
			'description' => __('Checked to show preloader', 'automotive-parts'),
			'section'     => 'automotive_parts_additional_section',
			'type'        => 'checkbox',
		)
	);

	/*Breadcrumbs Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_breadcrumbs',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_breadcrumbs',
		array(
			'label'       => __('Enable Breadcrumbs', 'automotive-parts'),
			'description' => __('Checked to show Breadcrumbs', 'automotive-parts'),
			'section'     => 'automotive_parts_additional_section',
			'type'        => 'checkbox',
		)
	);

	/*Pagination Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_pagination',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_pagination',
		array(
			'label'       => __('Enable Pagination', 'automotive-parts'),
			'description' => __('Checked to show Pagination', 'automotive-parts'),
			'section'     => 'automotive_parts_additional_section',
			'type'        => 'checkbox',
		)
	);

		/*Pagination Select Type Option*/
	$wp_customize->add_setting('automotive_parts_pagination_type',array(
        'default' => 'type-1',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
	));
	$wp_customize->add_control('automotive_parts_pagination_type',array(
        'type' => 'select',
        'label' => esc_html__('Select Pagination Type','automotive-parts'),
        'section' => 'automotive_parts_additional_section',
        'choices' => array(
            'type-1' => esc_html__('Type 1','automotive-parts'),
            'type-2' => esc_html__('Type 2','automotive-parts'),
        ),
	) );

	/*Post layout*/
	$wp_customize->add_setting('automotive_parts_archive_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
	));
	$wp_customize->add_control('automotive_parts_archive_layout',array(
        'type' => 'select',
        'label' => esc_html__('Posts Layout','automotive-parts'),
        'section' => 'automotive_parts_additional_section',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','automotive-parts'),
            'layout-2' => esc_html__('Sidebar On Left','automotive-parts'),
			'layout-3' => esc_html__('Full Width Layout','automotive-parts')
        ),
	) );

	/*single post layout*/
	$wp_customize->add_setting('automotive_parts_post_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
	));
	$wp_customize->add_control('automotive_parts_post_layout',array(
        'type' => 'select',
        'label' => esc_html__('Single Post Layout','automotive-parts'),
        'section' => 'automotive_parts_additional_section',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','automotive-parts'),
            'layout-2' => esc_html__('Sidebar On Left','automotive-parts'),
			'layout-3' => esc_html__('Full Width Layout','automotive-parts')
        ),
	) );

	/*single page layout*/
	$wp_customize->add_setting('automotive_parts_page_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
	));
	$wp_customize->add_control('automotive_parts_page_layout',array(
        'type' => 'select',
        'label' => esc_html__('Single Page Layout','automotive-parts'),
        'section' => 'automotive_parts_additional_section',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','automotive-parts'),
            'layout-2' => esc_html__('Sidebar On Left','automotive-parts'),
			'layout-3' => esc_html__('Full Width Layout','automotive-parts')
        ),
	) );

	$wp_customize->add_setting( 
		'automotive_parts_additional_settings_upgraded_features',
		array(
			'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control(
		'automotive_parts_additional_settings_upgraded_features', 
		array(
			'type'=> 'hidden',
			'description' => "
				<div class='customizer-upgraded-features'>
					<span class='pro-head'>Want more additional options?</span><br/>
					<span class='pro-text'>						
						<a target='_blank' href='". esc_url(AUTOMOTIVE_PARTS_BUY_NOW) ." '>Check Automotive Parts PRO version.</a>
					</div>
				</div>
			",
			'section' => 'automotive_parts_additional_section'
		)
	);

	/*Archive Post Options*/
	$wp_customize->add_section('automotive_parts_blog_post_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('Blog Page Options', 'automotive-parts'),
		'panel'       => 'automotive_parts_panel',
	));

	$wp_customize->add_setting('automotive_parts_enable_blog_post_title',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_blog_post_title',array(
		'label'       => __('Enable Blog Post Title', 'automotive-parts'),
		'description' => __('Checked To Show Blog Post Title', 'automotive-parts'),
		'section'     => 'automotive_parts_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_blog_post_meta',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_blog_post_meta',array(
		'label'       => __('Enable Blog Post Meta', 'automotive-parts'),
		'description' => __('Checked To Show Blog Post Meta Feilds', 'automotive-parts'),
		'section'     => 'automotive_parts_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_blog_post_tags',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_blog_post_tags',array(
		'label'       => __('Enable Blog Post Tags', 'automotive-parts'),
		'description' => __('Checked To Show Blog Post Tags', 'automotive-parts'),
		'section'     => 'automotive_parts_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_blog_post_image',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_blog_post_image',array(
		'label'       => __('Enable Blog Post Image', 'automotive-parts'),
		'description' => __('Checked To Show Blog Post Image', 'automotive-parts'),
		'section'     => 'automotive_parts_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_blog_post_content',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_blog_post_content',array(
		'label'       => __('Enable Blog Post Content', 'automotive-parts'),
		'description' => __('Checked To Show Blog Post Content', 'automotive-parts'),
		'section'     => 'automotive_parts_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_blog_post_button',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_blog_post_button',array(
		'label'       => __('Enable Blog Post Read More Button', 'automotive-parts'),
		'description' => __('Checked To Show Blog Post Read More Button', 'automotive-parts'),
		'section'     => 'automotive_parts_blog_post_section',
		'type'        => 'checkbox',
	));

	/*Blog post Content layout*/
	$wp_customize->add_setting('automotive_parts_blog_Post_content_layout',array(
        'default' => 'Left',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
	));
	$wp_customize->add_control('automotive_parts_blog_Post_content_layout',array(
        'type' => 'select',
        'label' => esc_html__('Blog Post Content Layout','automotive-parts'),
        'section' => 'automotive_parts_blog_post_section',
        'choices' => array(
            'Left' => esc_html__('Left','automotive-parts'),
            'Center' => esc_html__('Center','automotive-parts'),
            'Right' => esc_html__('Right','automotive-parts')
        ),
	) );

	/*Excerpt*/
    $wp_customize->add_setting(
		'automotive_parts_excerpt_limit',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '25',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_excerpt_limit',
		array(
			'label'       => __('Excerpt Limit', 'automotive-parts'),
			'section'     => 'automotive_parts_blog_post_section',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 2,
	             'max' => 50,
	             'step' => 2,
	         ),
		)
	);

	/*Archive Button Text*/
	$wp_customize->add_setting(
		'automotive_parts_read_more_text',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'Continue Reading....',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_read_more_text',
		array(
			'label'       => __('Edit Button Text ', 'automotive-parts'),
			'section'     => 'automotive_parts_blog_post_section',
			'type'        => 'text',
		)
	);

	/*Single Post Options*/
	$wp_customize->add_section('automotive_parts_single_post_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('Single Post Options', 'automotive-parts'),
		'panel'       => 'automotive_parts_panel',
	));

	$wp_customize->add_setting('automotive_parts_enable_single_blog_post_title',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_single_blog_post_title',array(
		'label'       => __('Enable Single Post Title', 'automotive-parts'),
		'description' => __('Checked To Show Single Blog Post Title', 'automotive-parts'),
		'section'     => 'automotive_parts_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_single_blog_post_meta',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_single_blog_post_meta',array(
		'label'       => __('Enable Single Post Meta', 'automotive-parts'),
		'description' => __('Checked To Show Single Blog Post Meta Feilds', 'automotive-parts'),
		'section'     => 'automotive_parts_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_single_blog_post_tags',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_single_blog_post_tags',array(
		'label'       => __('Enable Single Post Tags', 'automotive-parts'),
		'description' => __('Checked To Show Single Blog Post Tags', 'automotive-parts'),
		'section'     => 'automotive_parts_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_single_post_image',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_single_post_image',array(
		'label'       => __('Enable Single Post Image', 'automotive-parts'),
		'description' => __('Checked To Show Single Post Image', 'automotive-parts'),
		'section'     => 'automotive_parts_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('automotive_parts_enable_single_blog_post_content',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
	));
	$wp_customize->add_control('automotive_parts_enable_single_blog_post_content',array(
		'label'       => __('Enable Single Post Content', 'automotive-parts'),
		'description' => __('Checked To Show Single Blog Post Content', 'automotive-parts'),
		'section'     => 'automotive_parts_single_post_section',
		'type'        => 'checkbox',
	));

	/*Related Post Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_related_post',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_related_post',
		array(
			'label'       => __('Enable Related Post', 'automotive-parts'),
			'description' => __('Checked to show Related Post', 'automotive-parts'),
			'section'     => 'automotive_parts_single_post_section',
			'type'        => 'checkbox',
		)
	);

	/*Related post Edit Text*/
	$wp_customize->add_setting(
		'automotive_parts_related_post_text',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'Related Post',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_related_post_text',
		array(
			'label'       => __('Edit Related Post Text ', 'automotive-parts'),
			'section'     => 'automotive_parts_single_post_section',
			'type'        => 'text',
		)
	);	

	/*Related Post Per Page*/
	$wp_customize->add_setting(
		'automotive_parts_related_post_count',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '3',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_related_post_count',
		array(
			'label'       => __('Related Post Count', 'automotive-parts'),
			'section'     => 'automotive_parts_single_post_section',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 9,
	             'step' => 1,
	         ),
		)
	);

	/* Comment Section Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_comment_section',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_comment_section',
		array(
			'label'       => __('Enable Comment Section', 'automotive-parts'),
			'description' => __('Checked to show Comment Section', 'automotive-parts'),
			'section'     => 'automotive_parts_single_post_section',
			'type'        => 'checkbox',
		)
	);

	/*
	* Customizer Global COlor
	*/

	/*Global Color Options*/
	$wp_customize->add_section('automotive_parts_global_color_section', array(
		'priority'       => 1,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('Global Color Options', 'automotive-parts'),
		'panel'       => 'automotive_parts_panel',
	));

	$wp_customize->add_setting( 'automotive_parts_primary_color',
		array(
		'default'           => '#E52727',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control( 
		new WP_Customize_Color_Control( 
		$wp_customize, 
		'automotive_parts_primary_color',
		array(
			'label'      => esc_html__( 'Primary Color', 'automotive-parts' ),
			'section'    => 'automotive_parts_global_color_section',
			'settings'   => 'automotive_parts_primary_color',
		) ) 
	);

	$wp_customize->add_setting( 'automotive_parts_secondary_color',
		array(
		'default'           => '#FDB919',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control( 
		new WP_Customize_Color_Control( 
		$wp_customize, 
		'automotive_parts_secondary_color',
		array(
			'label'      => esc_html__( 'Secondary Color', 'automotive-parts' ),
			'section'    => 'automotive_parts_global_color_section',
			'settings'   => 'automotive_parts_secondary_color',
		) ) 
	);

	/*Typography Options*/
	$wp_customize->add_section( 'automotive_parts_typography_section', array(
		'panel'       => 'automotive_parts_panel',
        'title'    => __( 'Typography Options', 'automotive-parts' ),
        'priority' => 2,
    ) );

    $wp_customize->add_setting( 'automotive_parts_font_family', array(
		'default'           => 'default',
		'sanitize_callback' => 'automotive_parts_sanitize_font_family',
	) );
	
	$wp_customize->add_control( 'automotive_parts_font_family', array(
		'label'    => __( 'Global Font Family', 'automotive-parts' ),
		'section'  => 'automotive_parts_typography_section',
		'type'     => 'select',
		'choices'  => array(
			'default'          => __( 'Default (Theme Font)', 'automotive-parts' ),
			'bad_script'       => 'Bad Script',
			'roboto'           => 'Roboto',
			'playfair_display' => 'Playfair Display',
			'open_sans'        => 'Open Sans',
			'lobster'          => 'Lobster',
			'merriweather'     => 'Merriweather',
			'oswald'           => 'Oswald',
			'raleway'          => 'Raleway',
		),
	) );
	
/*
	* Customizer main header section
	*/
	/*Main Header Options*/
	$wp_customize->add_section('automotive_parts_header_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('Main Header Options', 'automotive-parts'),
		'panel'       => 'automotive_parts_panel',
	));

	$wp_customize->add_setting(
		'automotive_parts_show_topbar',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_show_topbar',
		array(
			'label'       => __('Enable Topbar', 'automotive-parts'),
			'description' => __('Checked to show the Topbar', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'checkbox',
		)
	);

	// Add Setting for Menu Text Transform
    $wp_customize->add_setting( 'automotive_parts_menu_text_transform', array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 'uppercase',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
    ) );

    // Add Control for Menu Text Transform
    $wp_customize->add_control( 'automotive_parts_menu_text_transform', array(
        'label'    => __( 'Menu Text Transform', 'automotive-parts' ),
        'section'  => 'automotive_parts_header_section',
        'type'     => 'select',
        'choices'  => array(
            'none'       => __( 'None', 'automotive-parts' ),
            'capitalize' => __( 'Capitalize', 'automotive-parts' ),
            'uppercase'  => __( 'Uppercase', 'automotive-parts' ),
            'lowercase'  => __( 'Lowercase', 'automotive-parts' ),
        ),
    ) );

	$wp_customize->add_setting(
		'automotive_parts_header_search',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_header_search',
		array(
			'label'       => __('Enable Disable Search', 'automotive-parts'),
			'description' => __('Enable or Disable header Search', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'checkbox',
		)
	);

	$wp_customize->add_setting('automotive_parts_add_location',array(
		'default'=> 'Lorem ipsum dolor sit amet, consectetuer adipiscing.',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('automotive_parts_add_location',array(
		'label'	=> __('Add Location','automotive-parts'),
		'section'=> 'automotive_parts_header_section',
		'type'=> 'text'
	));

	$wp_customize->add_setting(
		'automotive_parts_header_info_email',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'info@example.com',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_header_info_email',
		array(
			'label'       => __('Edit Email Address ', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'text',
		)
	);

	$wp_customize->add_setting(
		'automotive_parts_about_call_text',array(
			'default'=> '',
			'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control(
		'automotive_parts_about_call_text',array(
			'label'	=> __('Add Phone Text','automotive-parts'),
			'section'=> 'automotive_parts_header_section',
			'type'=> 'text'
	));

	$wp_customize->add_setting(
		'automotive_parts_about_call',
		array(
			'default'=> '',
			'sanitize_callback'	=> 'automotive_parts_sanitize_phone_number'
	));
	$wp_customize->add_control(
		'automotive_parts_about_call',array(
			'label'	=> __('Add Phone Number','automotive-parts'),
			'section'=> 'automotive_parts_header_section',
			'type'=> 'text'
	));

	/*Main Header Button Text*/
	$wp_customize->add_setting(
		'automotive_parts_header_button_text',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'BOOK AN APPOINTMENT',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_header_button_text',
		array(
			'label'       => __('Edit Button Text ', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'text',
		)
	);

	/*Main Header Button Link*/
	$wp_customize->add_setting(
		'automotive_parts_header_button_link',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_header_button_link',
		array(
			'label'       => __('Edit Button Link ', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'url',
		)
	);

	/*Facebook Link*/
	$wp_customize->add_setting(
		'automotive_parts_facebook_link_option',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'www.facebook.com',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_facebook_link_option',
		array(
			'label'       => __('Edit Facebook Link', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'url',
		)
	);

	/*Twitter Link*/
	$wp_customize->add_setting(
		'automotive_parts_twitter_link_option',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'www.twitter.com',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_twitter_link_option',
		array(
			'label'       => __('Edit Twitter Link', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'url',
		)
	);

	/*Instagram Link*/
	$wp_customize->add_setting(
		'automotive_parts_youtube_link_option',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'www.youtube.com',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_youtube_link_option',
		array(
			'label'       => __('Edit Youtube Link', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'url',
		)
	);

	$wp_customize->add_setting(
		'automotive_parts_google_plus_link_option',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'www.google.com',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_google_plus_link_option',
		array(
			'label'       => __('Edit Google Plus Link', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'url',
		)
	);

	$wp_customize->add_setting(
		'automotive_parts_pinterest_link_option',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'www.pinterest.com',
			'sanitize_callback' => 'esc_url_raw',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_pinterest_link_option',
		array(
			'label'       => __('Edit Pinterest Link', 'automotive-parts'),
			'section'     => 'automotive_parts_header_section',
			'type'        => 'url',
		)
	);

	$wp_customize->add_setting( 
		'automotive_parts_header_settings_upgraded_features',
		array(
			'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control(
		'automotive_parts_header_settings_upgraded_features', 
		array(
			'type'=> 'hidden',
			'description' => "
				<div class='customizer-upgraded-features'>
					<span class='pro-head'>Want more header options?</span><br/>
					<span class='pro-text'>						
						<a target='_blank' href='". esc_url(AUTOMOTIVE_PARTS_BUY_NOW) ." '>Check Automotive Parts PRO version.</a>
					</div>
				</div>
			",
			'section' => 'automotive_parts_header_section'
		)
	);

	/*
	* Customizer main slider section
	*/
	/*Main Slider Options*/
	$wp_customize->add_section('automotive_parts_slider_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('Main Slider Options', 'automotive-parts'),
		'panel'       => 'automotive_parts_panel',
	));

	/*Main Slider Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_slider',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 0,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_slider',
		array(
			'label'       => __('Enable Main Slider', 'automotive-parts'),
			'description' => __('Checked to show the main slider', 'automotive-parts'),
			'section'     => 'automotive_parts_slider_section',
			'type'        => 'checkbox',
		)
	);

	for ($automotive_parts_i=1; $automotive_parts_i <= 4; $automotive_parts_i++) { 

		/*Main Slider Image*/
		$wp_customize->add_setting(
			'automotive_parts_slider_image'.$automotive_parts_i,
			array(
				'capability'    => 'edit_theme_options',
		        'default'       => '',
		        'transport'     => 'postMessage',
		        'sanitize_callback' => 'esc_url_raw',
	    	)
	    );

		$wp_customize->add_control( 
			new WP_Customize_Image_Control( $wp_customize, 
				'automotive_parts_slider_image'.$automotive_parts_i, 
				array(
			        'label' => __('Edit Slider Image ', 'automotive-parts') .$automotive_parts_i,
			        'description' => __('Edit the slider image.', 'automotive-parts'),
			        'section' => 'automotive_parts_slider_section',
				)
			)
		);

		/*Main Slider Heading*/
		$wp_customize->add_setting(
			'automotive_parts_slider_top_text'.$automotive_parts_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'automotive_parts_slider_top_text'.$automotive_parts_i,
			array(
				'label'       => __('Edit Slider Top Text ', 'automotive-parts') .$automotive_parts_i,
				'description' => __('Edit the slider Top text.', 'automotive-parts'),
				'section'     => 'automotive_parts_slider_section',
				'type'        => 'text',
			)
		);

		/*Main Slider Heading*/
		$wp_customize->add_setting(
			'automotive_parts_slider_heading'.$automotive_parts_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'automotive_parts_slider_heading'.$automotive_parts_i,
			array(
				'label'       => __('Edit Heading Text ', 'automotive-parts') .$automotive_parts_i,
				'description' => __('Edit the slider heading text.', 'automotive-parts'),
				'section'     => 'automotive_parts_slider_section',
				'type'        => 'text',
			)
		);

		/*Main Slider Content*/
		$wp_customize->add_setting(
			'automotive_parts_slider_text'.$automotive_parts_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'automotive_parts_slider_text'.$automotive_parts_i,
			array(
				'label'       => __('Edit Content Text ', 'automotive-parts') .$automotive_parts_i,
				'description' => __('Edit the slider content text.', 'automotive-parts'),
				'section'     => 'automotive_parts_slider_section',
				'type'        => 'text',
			)
		);

		/*Main Slider Button1 Text*/
		$wp_customize->add_setting(
			'automotive_parts_slider_button1_text'.$automotive_parts_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);
		$wp_customize->add_control(
			'automotive_parts_slider_button1_text'.$automotive_parts_i,
			array(
				'label'       => __('Edit Button #1 Text ', 'automotive-parts') .$automotive_parts_i,
				'description' => __('Edit the slider button text.', 'automotive-parts'),
				'section'     => 'automotive_parts_slider_section',
				'type'        => 'text',
			)
		);

		/*Main Slider Button1 URL*/
		$wp_customize->add_setting(
			'automotive_parts_slider_button1_link'.$automotive_parts_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'esc_url_raw',
			)
		);

		$wp_customize->add_control(
			'automotive_parts_slider_button1_link'.$automotive_parts_i,
			array(
				'label'       => __('Edit Button #1 URL ', 'automotive-parts') .$automotive_parts_i,
				'description' => __('Edit the slider button url.', 'automotive-parts'),
				'section'     => 'automotive_parts_slider_section',
				'type'        => 'url',
			)
		);

		/*Main Slider Button2 Text*/
		$wp_customize->add_setting(
			'automotive_parts_slider_button2_text'.$automotive_parts_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);
		$wp_customize->add_control(
			'automotive_parts_slider_button2_text'.$automotive_parts_i,
			array(
				'label'       => __('Edit Button #2 Text ', 'automotive-parts') .$automotive_parts_i,
				'description' => __('Edit the slider button text.', 'automotive-parts'),
				'section'     => 'automotive_parts_slider_section',
				'type'        => 'text',
			)
		);

		/*Main Slider Button1 URL*/
		$wp_customize->add_setting(
			'automotive_parts_slider_button2_link'.$automotive_parts_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'esc_url_raw',
			)
		);

		$wp_customize->add_control(
			'automotive_parts_slider_button2_link'.$automotive_parts_i,
			array(
				'label'       => __('Edit Button #2 URL ', 'automotive-parts') .$automotive_parts_i,
				'description' => __('Edit the slider button url.', 'automotive-parts'),
				'section'     => 'automotive_parts_slider_section',
				'type'        => 'url',
			)
		);
	}

	$wp_customize->add_setting( 
		'automotive_parts_slider_settings_upgraded_features',
		array(
			'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control(
		'automotive_parts_slider_settings_upgraded_features', 
		array(
			'type'=> 'hidden',
			'description' => "
				<div class='customizer-upgraded-features'>
					<span class='pro-head'>Want more slider options?</span><br/>
					<span class='pro-text'>						
						<a target='_blank' href='". esc_url(AUTOMOTIVE_PARTS_BUY_NOW) ." '>Check Automotive Parts PRO version.</a>
					</div>
				</div>
			",
			'section' => 'automotive_parts_slider_section'
		)
	);

	/*
	* Customizer project section
	*/
	/*=========================================
	service Section
	=========================================*/

	$wp_customize->add_section(
		'automotive_parts_service_section', array(
			'title' => esc_html__( 'Our Services Section', 'automotive-parts' ),
			'priority' => 6,
			'panel' => 'automotive_parts_panel',
		)
	);

	// Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'automotive_parts_service_show_hide' , 
			array(
			'default' => false,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	$wp_customize->add_control(
	'automotive_parts_service_show_hide', 
		array(
			'label'	      => esc_html__( 'Hide / Show Section', 'automotive-parts' ),
			'section'     => 'automotive_parts_service_section',
			'settings'    => 'automotive_parts_service_show_hide',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting(
    	'automotive_parts_section_short_title',
    	array(
			'default' => '',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);	
	$wp_customize->add_control( 
		'automotive_parts_section_short_title',
		array(
		    'label'   		=> __('Add Short Title','automotive-parts'),
		    'section'		=> 'automotive_parts_service_section',
			'type' 			=> 'text',
		)
	);

	$wp_customize->add_setting(
    	'automotive_parts_section_title',
    	array(
			'default' => '',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);	
	$wp_customize->add_control( 
		'automotive_parts_section_title',
		array(
		    'label'   		=> __('Add Title','automotive-parts'),
		    'section'		=> 'automotive_parts_service_section',
			'type' 			=> 'text',
		)
	);

	$categories = get_categories();
	$offer_cat = array();
	$offer_cat[''] = __('Select', 'automotive-parts'); // Default "Select" option

	foreach($categories as $category){
	    $offer_cat[$category->slug] = $category->name;
	}

	$wp_customize->add_setting(
	    'automotive_parts_offer_section_category',
	    array(
	        'default' => 'uncategorized',
	        'sanitize_callback' => 'automotive_parts_sanitize_choices',
	    )
	);
	$wp_customize->add_control(
	    'automotive_parts_offer_section_category',
	    array(
	        'type' => 'select',
	        'choices' => $offer_cat,
	        'label' => __('Select Category','automotive-parts'),
	        'section' => 'automotive_parts_service_section',
	    )
	);

    // Setting for number of posts to show
    $wp_customize->add_setting('automotive_parts_posts_to_show', array(
        'default'           => 4, // Default number of posts to show
        'sanitize_callback' => 'absint', // Sanitization callback
    ));

    // Add control for number of posts to show
    $wp_customize->add_control('automotive_parts_posts_to_show', array(
        'label'       => __('Number of Post to Show', 'automotive-parts'),
        'section'     => 'automotive_parts_service_section',
        'priority'    => 10,
        'type'        => 'number',
        'input_attrs' => array(
            'step' => 1,
            'min'  => 0,
            'max'  => 50,
        ),
    ));

    // Get the number of posts to show
    $automotive_parts_posts_to_show = get_theme_mod('automotive_parts_posts_to_show', 4);
    
    // Loop to create settings and controls for each post's price and star rating
    for ($automotive_parts_i = 1; $automotive_parts_i <= $automotive_parts_posts_to_show; $automotive_parts_i++) {

    	$wp_customize->add_setting('automotive_parts_team_role' . $automotive_parts_i, array(
            'default' => '',
            'sanitize_callback' => 'sanitize_text_field'
        ));

        $wp_customize->add_control('automotive_parts_team_role' . $automotive_parts_i, array(
            'label'    => __('Add Name of Car Mechanic for Post ', 'automotive-parts') . $automotive_parts_i,
            'section'  => 'automotive_parts_service_section',
            'type'     => 'text',
            'priority' => 998,
        ));

    	$wp_customize->add_setting('automotive_parts_serv_facebook_url' . $automotive_parts_i, array(
            'default' => '#',
            'sanitize_callback' => 'esc_url_raw'
        ));

        $wp_customize->add_control('automotive_parts_serv_facebook_url' . $automotive_parts_i, array(
            'label'    => __('Add Facebook Link for Post ', 'automotive-parts') . $automotive_parts_i,
            'section'  => 'automotive_parts_service_section',
            'type'     => 'text',
            'priority' => 998,
        ));

        $wp_customize->add_setting('automotive_parts_serv_twitter_url' . $automotive_parts_i, array(
            'default' => '#',
            'sanitize_callback' => 'esc_url_raw'
        ));

        $wp_customize->add_control('automotive_parts_serv_twitter_url' . $automotive_parts_i, array(
            'label'    => __('Add Twitter Link for Post', 'automotive-parts') . $automotive_parts_i,
            'section'  => 'automotive_parts_service_section',
            'type'     => 'text',
            'priority' => 998,
        ));

        $wp_customize->add_setting('automotive_parts_serv_youtube_url' . $automotive_parts_i, array(
            'default' => '#',
            'sanitize_callback' => 'esc_url_raw'
        ));

        $wp_customize->add_control('automotive_parts_serv_youtube_url' . $automotive_parts_i, array(
            'label'    => __('Add Youtube Link for Post', 'automotive-parts') . $automotive_parts_i,
            'section'  => 'automotive_parts_service_section',
            'type'     => 'text',
            'priority' => 998,
        ));

        $wp_customize->add_setting('automotive_parts_serv_google_plus_url' . $automotive_parts_i, array(
            'default' => '#',
            'sanitize_callback' => 'esc_url_raw'
        ));
        $wp_customize->add_control('automotive_parts_serv_google_plus_url' . $automotive_parts_i, array(
            'label'    => __('Add Google Plus Link for Post', 'automotive-parts') . $automotive_parts_i,
            'section'  => 'automotive_parts_service_section',
            'type'     => 'text',
            'priority' => 998,
        ));

        $wp_customize->add_setting('automotive_parts_serv_linked_url' . $automotive_parts_i, array(
            'default' => '#',
            'sanitize_callback' => 'esc_url_raw'
        ));

        $wp_customize->add_control('automotive_parts_serv_linked_url' . $automotive_parts_i, array(
            'label'    => __('Add Linkedin Link for Post', 'automotive-parts') . $automotive_parts_i,
            'section'  => 'automotive_parts_service_section',
            'type'     => 'text',
            'priority' => 998,
        ));
    }

	$wp_customize->add_setting( 
		'automotive_parts_service_settings_upgraded_features',
		array(
			'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control(
		'automotive_parts_service_settings_upgraded_features', 
		array(
			'type'=> 'hidden',
			'description' => "
				<div class='customizer-upgraded-features'>
					<span class='pro-head'>Want more services options?</span><br/>
					<span class='pro-text'>						
						<a target='_blank' href='". esc_url(AUTOMOTIVE_PARTS_BUY_NOW) ." '>Check Automotive Parts PRO version.</a>
					</div>
				</div>
			",
			'section' => 'automotive_parts_service_section',
			'priority' => 998,
		)
	);

	/*
	* Customizer Footer Section
	*/
	/*Footer Options*/
	$wp_customize->add_section('automotive_parts_footer_section', array(
		'priority'       => 8,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => __('Footer Options', 'automotive-parts'),
		'panel'       => 'automotive_parts_panel',
	));
	
	/*Footer Enable Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_footer',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);
	$wp_customize->add_control(
		'automotive_parts_enable_footer',
		array(
			'label'       => __('Enable Footer', 'automotive-parts'),
			'description' => __('Checked to show Footer', 'automotive-parts'),
			'section'     => 'automotive_parts_footer_section',
			'type'        => 'checkbox',
		)
	);

	/*Footer bg image Option*/
	$wp_customize->add_setting('automotive_parts_footer_bg_image',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
        'default'           => '',
        'sanitize_callback' => 'esc_url_raw',
    ));
    $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'automotive_parts_footer_bg_image',array(
        'label' => __('Footer Background Image','automotive-parts'),
        'section' => 'automotive_parts_footer_section',
    )));

	/** Footer bg Image Attachment */
    $wp_customize->add_setting('automotive_parts_background_attachment', array(
        'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 'scroll',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
    ));

    $wp_customize->add_control('automotive_parts_background_attachment', array(
        'label'    => __('Footer Background Attachment', 'automotive-parts'),
        'section'  => 'automotive_parts_footer_section',
        'settings' => 'automotive_parts_background_attachment',
        'type'     => 'select',
        'choices'  => array(
            'fixed' => __('fixed','automotive-parts'),
            'scroll' => __('scroll','automotive-parts'),
        ),
    ));

	/*Footer Social Menu Option*/
	$wp_customize->add_setting(
		'automotive_parts_footer_social_menu',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_footer_social_menu',
		array(
			'label'       => __('Enable Footer Social Menu', 'automotive-parts'),
			'description' => __('Checked to show the footer social menu. Go to Dashboard >> Appearance >> Menus >> Create New Menu >> Add Custom Link >> Add Social Menu >> Checked Social Menu >> Save Menu.', 'automotive-parts'),
			'section'     => 'automotive_parts_footer_section',
			'type'        => 'checkbox',
		)
	);	

	/*Go To Top Option*/
	$wp_customize->add_setting(
		'automotive_parts_enable_go_to_top_option',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'automotive_parts_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_enable_go_to_top_option',
		array(
			'label'       => __('Enable Go To Top', 'automotive-parts'),
			'description' => __('Checked to enable Go To Top option.', 'automotive-parts'),
			'section'     => 'automotive_parts_footer_section',
			'type'        => 'checkbox',
		)
	);

	$wp_customize->add_setting('automotive_parts_go_to_top_position',array(
        'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 'Right',
        'sanitize_callback' => 'automotive_parts_sanitize_choices'
    ));
    $wp_customize->add_control('automotive_parts_go_to_top_position',array(
        'type' => 'select',
        'section' => 'automotive_parts_footer_section',
        'label' => esc_html__('Go To Top Positions','automotive-parts'),
        'choices' => array(
            'Right' => __('Right','automotive-parts'),
            'Left' => __('Left','automotive-parts'),
            'Center' => __('Center','automotive-parts')
        ),
    ) );

	/*Footer Copyright Text Enable*/
	$wp_customize->add_setting(
		'automotive_parts_copyright_option',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'automotive_parts_copyright_option',
		array(
			'label'       => __('Edit Copyright Text', 'automotive-parts'),
			'description' => __('Edit the Footer Copyright Section.', 'automotive-parts'),
			'section'     => 'automotive_parts_footer_section',
			'type'        => 'text',
		)
	);

	$wp_customize->add_setting( 
		'automotive_parts_footersettings_upgraded_features',
		array(
			'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control(
		'automotive_parts_footersettings_upgraded_features', 
		array(
			'type'=> 'hidden',
			'description' => "
				<div class='customizer-upgraded-features'>
					<span class='pro-head'>Want more footer options?</span><br/>
					<span class='pro-text'>						
						<a target='_blank' href='". esc_url(AUTOMOTIVE_PARTS_BUY_NOW) ." '>Check Automotive Parts PRO version.</a>
					</div>
				</div>
			",
			'section' => 'automotive_parts_footer_section'
		)
	);
}
add_action( 'customize_register', 'Automotive_Parts_Customize_register' );

/**
 * Render the site title for the selective refresh partial.
 *
 * @return void
 */
function Automotive_Parts_Customize_partial_blogname() {
	bloginfo( 'name' );
}

/**
 * Render the site tagline for the selective refresh partial.
 *
 * @return void
 */
function Automotive_Parts_Customize_partial_blogdescription() {
	bloginfo( 'description' );
}

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function Automotive_Parts_Customize_preview_js() {
	wp_enqueue_script( 'automotive-parts-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), AUTOMOTIVE_PARTS_VERSION, true );
}
add_action( 'customize_preview_init', 'Automotive_Parts_Customize_preview_js' );

/**
 * Singleton class for handling the theme's customizer integration.
 *
 * @since  1.0.0
 * @access public
 */
final class Automotive_Parts_Customize {

	/**
	 * Returns the instance.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return object
	 */
	public static function get_instance() {

		static $automotive_parts_instance = null;

		if ( is_null( $automotive_parts_instance ) ) {
			$automotive_parts_instance = new self;
			$automotive_parts_instance->setup_actions();
		}

		return $automotive_parts_instance;
	}

	/**
	 * Constructor method.
	 *
	 * @since  1.0.0
	 * @access private
	 * @return void
	 */
	private function __construct() {}

	/**
	 * Sets up initial actions.
	 *
	 * @since  1.0.0
	 * @access private
	 * @return void
	 */
	private function setup_actions() {

		// Register panels, sections, settings, controls, and partials.
		add_action( 'customize_register', array( $this, 'sections' ) );

		// Register scripts and styles for the controls.
		add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 );
	}

	/**
	 * Sets up the customizer sections.
	 *
	 * @since  1.0.0
	 * @access public
	 * @param  object  $automotive_parts_manager
	 * @return void
	*/
	public function sections( $automotive_parts_manager ) {
		// Load custom sections.
		load_template( trailingslashit( get_template_directory() ) . '/revolution/inc/section-pro.php' );

		// Register custom section types.
		$automotive_parts_manager->register_section_type( 'Automotive_Parts_Customize_Section_Pro' );

		// Register sections.
		$automotive_parts_manager->add_section( new Automotive_Parts_Customize_Section_Pro( $automotive_parts_manager,'automotive_parts_go_pro', array(
			'priority'   => 1,
			'title'    => esc_html__( 'Automotive Parts Pro', 'automotive-parts' ),
			'pro_text' => esc_html__( 'Buy Pro', 'automotive-parts' ),
			'pro_url'    => esc_url( AUTOMOTIVE_PARTS_BUY_NOW ),
		) )	);

		// Register sections.
		$automotive_parts_manager->add_section( new Automotive_Parts_Customize_Section_Pro( $automotive_parts_manager,'automotive_parts_lite_documentation', array(
			'priority'   => 1,
			'title'    => esc_html__( 'Lite Documentation', 'automotive-parts' ),
			'pro_text' => esc_html__( 'Instruction', 'automotive-parts' ),
			'pro_url'    => esc_url( AUTOMOTIVE_PARTS_LITE_DOC ),
		) )	);

		$automotive_parts_manager->add_section( new Automotive_Parts_Customize_Section_Pro( $automotive_parts_manager, 'automotive_parts_live_demo', array(
		    'priority'   => 1,
		    'title'      => esc_html__( 'Pro Theme Demo', 'automotive-parts' ),
		    'pro_text'   => esc_html__( 'Live Preview', 'automotive-parts' ),
		    'pro_url'    => esc_url( AUTOMOTIVE_PARTS_LIVE_DEMO ),
		) ) );	
	}

	/**
	 * Loads theme customizer CSS.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return void
	 */
	public function enqueue_control_scripts() {

		wp_enqueue_script( 'automotive-parts-customize-controls', trailingslashit( get_template_directory_uri() ) . '/revolution/assets/js/customize-controls.js', array( 'customize-controls' ) );

		wp_enqueue_style( 'automotive-parts-customize-controls', trailingslashit( get_template_directory_uri() ) . '/revolution/assets/css/customize-controls.css' );
	}
}

// Doing this customizer thang!
Automotive_Parts_Customize::get_instance();