<?php
/**
 * Carpets and Rugs Theme Customizer
 *
 * @package Carpets and Rugs
 */

function Carpets_and_Rugs_Customize_register( $wp_customize ) {

	load_template( trailingslashit( get_template_directory() ) . 'revolution/inc/fontawesome-change.php' );

	$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' => 'Carpets_and_Rugs_Customize_partial_blogname',
			)
		);
		$wp_customize->selective_refresh->add_partial(
			'blogdescription',
			array(
				'selector'        => '.site-description',
				'render_callback' => 'Carpets_and_Rugs_Customize_partial_blogdescription',
			)
		);
	}

	/*
    * Theme Options Panel
    */
	$wp_customize->add_panel('carpets_and_rugs_panel', array(
		'priority' => 25,
		'capability' => 'edit_theme_options',
		'title' => esc_html__('Carpets and Rugs Theme Options', 'carpets-and-rugs'),
	));

	/*
	* Customizer main header section
	*/

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

	$wp_customize->add_control(
		'carpets_and_rugs_site_title_text',
		array(
			'label'       => esc_html__('Enable Title', 'carpets-and-rugs'),
			'description' => esc_html__('Enable or Disable Title from the site', 'carpets-and-rugs'),
			'section'     => 'title_tagline',
			'type'        => 'checkbox',
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_site_tagline_text',
		array(
			'label'       => esc_html__('Enable Tagline', 'carpets-and-rugs'),
			'description' => esc_html__('Enable or Disable Tagline from the site', 'carpets-and-rugs'),
			'section'     => 'title_tagline',
			'type'        => 'checkbox',
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_logo_width',
		array(
			'label'       => esc_html__('Logo Width in PX', 'carpets-and-rugs'),
			'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'          => esc_html__('WooCommerce Custom Settings', 'carpets-and-rugs'),
		'panel'       => 'woocommerce',
	));

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

	$wp_customize->add_control(
		'carpets_and_rugs_per_columns',
		array(
			'label'       => esc_html__('Product Per Single Row', 'carpets-and-rugs'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 4,
	             'step' => 1,
	         ),
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_product_per_page',
		array(
			'label'       => esc_html__('Product Per One Page', 'carpets-and-rugs'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 12,
	             'step' => 1,
	         ),
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_related_product',
		array(
			'label'       => esc_html__('Enable Related Product', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show Related Product', 'carpets-and-rugs'),
			'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'       => esc_html__('Related Product Count', 'carpets-and-rugs'),
			'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'       => esc_html__('Related Product Per Row', 'carpets-and-rugs'),
			'section'     => 'woocommerce_custom_settings',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 4,
	             'step' => 1,
	         ),
		)
	);

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

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

	$wp_customize->add_setting('carpets_and_rugs_woocommerce_product_sale',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
        'default'           => 'Right',
        'sanitize_callback' => 'carpets_and_rugs_sanitize_choices'
    ));
    $wp_customize->add_control('carpets_and_rugs_woocommerce_product_sale',array(
        'label'       => esc_html__( 'Woocommerce Product Sale Positions','carpets-and-rugs' ),
        'type' => 'select',
        'section' => 'woocommerce_custom_settings',
        'choices' => array(
            'Right' => esc_html__('Right','carpets-and-rugs'),
            'Left' => esc_html__('Left','carpets-and-rugs'),
            'Center' => esc_html__('Center','carpets-and-rugs')
        ),
    ) );

	/*Additional Options*/
	$wp_customize->add_section('carpets_and_rugs_additional_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Additional Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_sticky_header',
		array(
			'label'       => esc_html__('Enable Sticky Header', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to enable sticky header', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_additional_section',
			'type'        => 'checkbox',
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_preloader',
		array(
			'label'       => esc_html__('Enable Preloader', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show preloader', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_additional_section',
			'type'        => 'checkbox',
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_breadcrumbs',
		array(
			'label'       => esc_html__('Enable Breadcrumbs', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show Breadcrumbs', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_additional_section',
			'type'        => 'checkbox',
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_pagination',
		array(
			'label'       => esc_html__('Enable Pagination', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show Pagination', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_additional_section',
			'type'        => 'checkbox',
		)
	);

		/*Pagination Select Type Option*/
	$wp_customize->add_setting('carpets_and_rugs_pagination_type',array(
        'default' => 'type-1',
        'sanitize_callback' => 'carpets_and_rugs_sanitize_choices'
	));
	$wp_customize->add_control('carpets_and_rugs_pagination_type',array(
        'type' => 'select',
        'label' => esc_html__('Select Pagination Type','carpets-and-rugs'),
        'section' => 'carpets_and_rugs_additional_section',
        'choices' => array(
            'type-1' => esc_html__('Type 1','carpets-and-rugs'),
            'type-2' => esc_html__('Type 2','carpets-and-rugs'),
        ),
	) );

	/*Post layout*/
	$wp_customize->add_setting('carpets_and_rugs_archive_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'carpets_and_rugs_sanitize_choices'
	));
	$wp_customize->add_control('carpets_and_rugs_archive_layout',array(
        'type' => 'select',
        'label' => esc_html__('Posts Layout','carpets-and-rugs'),
        'section' => 'carpets_and_rugs_additional_section',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','carpets-and-rugs'),
            'layout-2' => esc_html__('Sidebar On Left','carpets-and-rugs'),
            'layout-3' => esc_html__('Full Width Layout','carpets-and-rugs')
        ),
	) );

	/*single post layout*/
	$wp_customize->add_setting('carpets_and_rugs_post_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'carpets_and_rugs_sanitize_choices'
	));
	$wp_customize->add_control('carpets_and_rugs_post_layout',array(
        'type' => 'select',
        'label' => esc_html__('Single Post Layout','carpets-and-rugs'),
        'section' => 'carpets_and_rugs_additional_section',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','carpets-and-rugs'),
            'layout-2' => esc_html__('Sidebar On Left','carpets-and-rugs'),
            'layout-3' => esc_html__('Full Width Layout','carpets-and-rugs')
        ),
	) );

	/*single page layout*/
	$wp_customize->add_setting('carpets_and_rugs_page_layout',array(
        'default' => 'layout-1',
        'sanitize_callback' => 'carpets_and_rugs_sanitize_choices'
	));
	$wp_customize->add_control('carpets_and_rugs_page_layout',array(
        'type' => 'select',
        'label' => esc_html__('Single Page Layout','carpets-and-rugs'),
        'section' => 'carpets_and_rugs_additional_section',
        'choices' => array(
            'layout-1' => esc_html__('Sidebar On Right','carpets-and-rugs'),
            'layout-2' => esc_html__('Sidebar On Left','carpets-and-rugs'),
            'layout-3' => esc_html__('Full Width Layout','carpets-and-rugs')
        ),
	) );

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

	$wp_customize->add_control(
		'carpets_and_rugs_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(CARPETS_AND_RUGS_BUY_NOW) ." '>Check Carpets and Rugs PRO version.</a>
					</div>
				</div>
			",
			'section' => 'carpets_and_rugs_additional_section'
		)
	);

	/*Archive Post Options*/
	$wp_customize->add_section('carpets_and_rugs_blog_post_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Blog Page Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_blog_post_title',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_blog_post_title',array(
		'label'       => esc_html__('Enable Blog Post Title', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Blog Post Title', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_blog_post_meta',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_blog_post_meta',array(
		'label'       => esc_html__('Enable Blog Post Meta', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Blog Post Meta Feilds', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_blog_post_tags',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_blog_post_tags',array(
		'label'       => esc_html__('Enable Blog Post Tags', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Blog Post Tags', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_blog_post_image',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_blog_post_image',array(
		'label'       => esc_html__('Enable Blog Post Image', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Blog Post Image', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_blog_post_content',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_blog_post_content',array(
		'label'       => esc_html__('Enable Blog Post Content', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Blog Post Content', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_blog_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_blog_post_button',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_blog_post_button',array(
		'label'       => esc_html__('Enable Blog Post Read More Button', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Blog Post Read More Button', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_blog_post_section',
		'type'        => 'checkbox',
	));

	/*Blog post Content layout*/
	$wp_customize->add_setting('carpets_and_rugs_blog_Post_content_layout',array(
        'default' => 'Left',
        'sanitize_callback' => 'carpets_and_rugs_sanitize_choices'
	));
	$wp_customize->add_control('carpets_and_rugs_blog_Post_content_layout',array(
        'type' => 'select',
        'label' => esc_html__('Blog Post Content Layout','carpets-and-rugs'),
        'section' => 'carpets_and_rugs_blog_post_section',
        'choices' => array(
            'Left' => esc_html__('Left','carpets-and-rugs'),
            'Center' => esc_html__('Center','carpets-and-rugs'),
            'Right' => esc_html__('Right','carpets-and-rugs')
        ),
	) );

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

	$wp_customize->add_control(
		'carpets_and_rugs_excerpt_limit',
		array(
			'label'       => esc_html__('Excerpt Limit', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_blog_post_section',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 2,
	             'max' => 50,
	             'step' => 2,
	         ),
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_read_more_text',
		array(
			'label'       => esc_html__('Edit Button Text ', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_blog_post_section',
			'type'        => 'text',
		)
	);

	/*Single Post Options*/
	$wp_customize->add_section('carpets_and_rugs_single_post_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Single Post Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_single_blog_post_title',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_single_blog_post_title',array(
		'label'       => esc_html__('Enable Single Post Title', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Single Blog Post Title', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_single_blog_post_meta',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_single_blog_post_meta',array(
		'label'       => esc_html__('Enable Single Post Meta', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Single Blog Post Meta Feilds', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_single_blog_post_tags',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_single_blog_post_tags',array(
		'label'       => esc_html__('Enable Single Post Tags', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Single Blog Post Tags', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_single_post_image',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_single_post_image',array(
		'label'       => esc_html__('Enable Single Post Image', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Single Post Image', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_single_post_section',
		'type'        => 'checkbox',
	));

	$wp_customize->add_setting('carpets_and_rugs_enable_single_blog_post_content',array(
		'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 1,
		'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
	));
	$wp_customize->add_control('carpets_and_rugs_enable_single_blog_post_content',array(
		'label'       => esc_html__('Enable Single Post Content', 'carpets-and-rugs'),
		'description' => esc_html__('Checked To Show Single Blog Post Content', 'carpets-and-rugs'),
		'section'     => 'carpets_and_rugs_single_post_section',
		'type'        => 'checkbox',
	));

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_related_post',
		array(
			'label'       => esc_html__('Enable Related Post', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show Related Post', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_single_post_section',
			'type'        => 'checkbox',
		)
	);

	$wp_customize->add_setting(
		'carpets_and_rugs_related_post_text',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'Related Post',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'carpets_and_rugs_related_post_text',
		array(
			'label'       => esc_html__('Edit Related Post Text ', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_single_post_section',
			'type'        => 'text',
		)
	);	

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

	$wp_customize->add_control(
		'carpets_and_rugs_related_post_count',
		array(
			'label'       => esc_html__('Related Post Count', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_single_post_section',
			'type'        => 'number',
			'input_attrs' => array(
	            'min' => 1,
	             'max' => 9,
	             'step' => 1,
	         ),
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_comment_section',
		array(
			'label'       => esc_html__('Enable Comment Section', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show Comment Section', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_single_post_section',
			'type'        => 'checkbox',
		)
	);

	/*
	* Customizer Global COlor
	*/

	/*Global Color Options*/
	$wp_customize->add_section('carpets_and_rugs_global_color_section', array(
		'priority'       => 1,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Global Color Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));

	$wp_customize->add_setting( 'carpets_and_rugs_primary_color',
		array(
		'default'           => '#483131',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control( 
		new WP_Customize_Color_Control( 
		$wp_customize, 
		'carpets_and_rugs_primary_color',
		array(
			'label'      => esc_html__( 'Primary Color', 'carpets-and-rugs' ),
			'section'    => 'carpets_and_rugs_global_color_section',
			'settings'   => 'carpets_and_rugs_primary_color',
		) ) 
	);

	$wp_customize->add_setting( 'carpets_and_rugs_secondary_color',
		array(
		'default'           => '#B48D83',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	$wp_customize->add_control( 
		new WP_Customize_Color_Control( 
		$wp_customize, 
		'carpets_and_rugs_secondary_color',
		array(
			'label'      => esc_html__( 'Secondary Color', 'carpets-and-rugs' ),
			'section'    => 'carpets_and_rugs_global_color_section',
			'settings'   => 'carpets_and_rugs_secondary_color',
		) ) 
	);
		
	/*Typography Options*/
	$wp_customize->add_section( 'carpets_and_rugs_typography_section', array(
		'panel'       => 'carpets_and_rugs_panel',
        'title'    => esc_html__( 'Typography Options', 'carpets-and-rugs' ),
        'priority' => 2,
    ) );

    $wp_customize->add_setting( 'carpets_and_rugs_font_family', array(
		'default'           => 'default',
		'sanitize_callback' => 'carpets_and_rugs_sanitize_font_family',
	) );
	
	$wp_customize->add_control( 'carpets_and_rugs_font_family', array(
		'label'    => esc_html__( 'Global Font Family', 'carpets-and-rugs' ),
		'section'  => 'carpets_and_rugs_typography_section',
		'type'     => 'select',
		'choices'  => array(
			'default'          => esc_html__( 'Default (Theme Font)', 'carpets-and-rugs' ),
			'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('carpets_and_rugs_header_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Main Header Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));

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

    // Add Control for Menu Text Transform
    $wp_customize->add_control( 'carpets_and_rugs_menu_text_transform', array(
        'label'    => esc_html__( 'Menu Text Transform', 'carpets-and-rugs' ),
        'section'  => 'carpets_and_rugs_header_section',
        'type'     => 'select',
        'choices'  => array(
            'none'       => esc_html__( 'None', 'carpets-and-rugs' ),
            'capitalize' => esc_html__( 'Capitalize', 'carpets-and-rugs' ),
            'uppercase'  => esc_html__( 'Uppercase', 'carpets-and-rugs' ),
            'lowercase'  => esc_html__( 'Lowercase', 'carpets-and-rugs' ),
        ),
    ) );

	$wp_customize->add_setting(
		'carpets_and_rugs_show_topbar',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
		)
	);
	$wp_customize->add_control(
		'carpets_and_rugs_show_topbar',
		array(
			'label'       => esc_html__('Enable Topbar', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show the Topbar', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_header_section',
			'type'        => 'checkbox',
		)
	);

	$wp_customize->add_setting('carpets_and_rugs_order_shipping_text',array(
		'default'	=> 'FREE SHIPPING',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('carpets_and_rugs_order_shipping_text',array(
		'label'	=> esc_html__('Add Free Shipping Text','carpets-and-rugs'),
		'section'	=> 'carpets_and_rugs_header_section',
		'type'		=> 'text'
	));
	
	$wp_customize->add_setting('carpets_and_rugs_order_shipping_link',array(
		'default'	=> '#',
		'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('carpets_and_rugs_order_shipping_link',array(
		'label'	=> esc_html__('Add Free Shipping Link','carpets-and-rugs'),
		'section'	=> 'carpets_and_rugs_header_section',
		'type'		=> 'url'
	));

	$wp_customize->add_setting('carpets_and_rugs_delivery_text',array(
		'default'=> 'on orders over $99. This offer is valid on all store items.',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('carpets_and_rugs_delivery_text',array(
		'label'	=> esc_html__('Add Offer Text','carpets-and-rugs'),
		'section'=> 'carpets_and_rugs_header_section',
		'type'=> 'text'
	));

	/*Main Header Phone Text*/
	$wp_customize->add_setting(
		'carpets_and_rugs_header_info_phone',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => '123 111 7895',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'carpets_and_rugs_header_info_phone',
		array(
			'label'       => esc_html__('Edit Phone Number ', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_header_section',
			'type'        => 'text',
		)
	);

	$wp_customize->add_setting('carpets_and_rugs_header_phone_icon',array(
		'default'	=> 'fas fa-phone-alt',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control(new Carpets_and_Rugs_Icon_Changer(
        $wp_customize,'carpets_and_rugs_header_phone_icon',array(
		'label'	=> esc_html__('Phone Number Icon','carpets-and-rugs'),
		'transport' => 'refresh',
		'section'	=> 'carpets_and_rugs_header_section',
		'type'		=> 'icon'
	)));

	/*Main Header Phone Text*/
	$wp_customize->add_setting(
		'carpets_and_rugs_header_info_email',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 'carpetstore@exmple.com',
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	$wp_customize->add_control(
		'carpets_and_rugs_header_info_email',
		array(
			'label'       => esc_html__('Edit Email Address ', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_header_section',
			'type'        => 'text',
		)
	);

	$wp_customize->add_setting('carpets_and_rugs_header_mail_icon',array(
		'default'	=> 'far fa-envelope-open',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control(new Carpets_and_Rugs_Icon_Changer(
        $wp_customize,'carpets_and_rugs_header_mail_icon',array(
		'label'	=> esc_html__('Mail Icon','carpets-and-rugs'),
		'transport' => 'refresh',
		'section'	=> 'carpets_and_rugs_header_section',
		'type'		=> 'icon'
	)));

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

	$wp_customize->add_control(
		'carpets_and_rugs_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(CARPETS_AND_RUGS_BUY_NOW) ." '>Check Carpets and Rugs PRO version.</a>
					</div>
				</div>
			",
			'section' => 'carpets_and_rugs_header_section'
		)
	);

	/*
	* Customizer main slider section
	*/
	/*Main Slider Options*/
	$wp_customize->add_section('carpets_and_rugs_slider_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Main Slider Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));

	/*Main product cat Option*/
	$wp_customize->add_setting(
		'carpets_and_rugs_show_product_cat',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
		)
	);
	$wp_customize->add_control(
		'carpets_and_rugs_show_product_cat',
		array(
			'label'       => esc_html__('Enable Product Category', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show the Product Category', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_slider_section',
			'type'        => 'checkbox',
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_slider',
		array(
			'label'       => esc_html__('Enable Main Slider', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show the main slider', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_slider_section',
			'type'        => 'checkbox',
		)
	);

	for ($carpets_and_rugs_i=1; $carpets_and_rugs_i <= 3; $carpets_and_rugs_i++) { 

		/*Main Slider Image*/
		$wp_customize->add_setting(
			'carpets_and_rugs_slider_image'.$carpets_and_rugs_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, 
				'carpets_and_rugs_slider_image'.$carpets_and_rugs_i, 
				array(
			        'label' => esc_html__('Edit Slider Image ', 'carpets-and-rugs') .$carpets_and_rugs_i,
			        'description' => esc_html__('Edit the slider image.', 'carpets-and-rugs'),
			        'section' => 'carpets_and_rugs_slider_section',
				)
			)
		);

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

		$wp_customize->add_control(
			'carpets_and_rugs_slider_xtra_heading'.$carpets_and_rugs_i,
			array(
				'label'       => esc_html__('Edit Extra Heading Text ', 'carpets-and-rugs') .$carpets_and_rugs_i,
				'description' => esc_html__('Edit the slider Extra heading text.', 'carpets-and-rugs'),
				'section'     => 'carpets_and_rugs_slider_section',
				'type'        => 'text',
			)
		);

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

		$wp_customize->add_control(
			'carpets_and_rugs_slider_heading'.$carpets_and_rugs_i,
			array(
				'label'       => esc_html__('Edit Heading Text ', 'carpets-and-rugs') .$carpets_and_rugs_i,
				'description' => esc_html__('Edit the slider heading text.', 'carpets-and-rugs'),
				'section'     => 'carpets_and_rugs_slider_section',
				'type'        => 'text',
			)
		);

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

		$wp_customize->add_control(
			'carpets_and_rugs_slider_text'.$carpets_and_rugs_i,
			array(
				'label'       => esc_html__('Edit Content Text ', 'carpets-and-rugs') .$carpets_and_rugs_i,
				'description' => esc_html__('Edit the slider content text.', 'carpets-and-rugs'),
				'section'     => 'carpets_and_rugs_slider_section',
				'type'        => 'text',
			)
		);

		/*Main Slider Button1 Text*/
		$wp_customize->add_setting(
			'carpets_and_rugs_slider_button1_text'.$carpets_and_rugs_i,
			array(
				'capability'        => 'edit_theme_options',
				'transport'         => 'refresh',
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'carpets_and_rugs_slider_button1_text'.$carpets_and_rugs_i,
			array(
				'label'       => esc_html__('Edit Button Text ', 'carpets-and-rugs') .$carpets_and_rugs_i,
				'description' => esc_html__('Edit the slider button text.', 'carpets-and-rugs'),
				'section'     => 'carpets_and_rugs_slider_section',
				'type'        => 'text',
			)
		);

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

		$wp_customize->add_control(
			'carpets_and_rugs_slider_button1_link'.$carpets_and_rugs_i,
			array(
				'label'       => esc_html__('Edit Button URL ', 'carpets-and-rugs') .$carpets_and_rugs_i,
				'description' => esc_html__('Edit the slider button url.', 'carpets-and-rugs'),
				'section'     => 'carpets_and_rugs_slider_section',
				'type'        => 'url',
			)
		);

	}

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

	$wp_customize->add_control(
		'carpets_and_rugs_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(CARPETS_AND_RUGS_BUY_NOW) ." '>Check Carpets and Rugs PRO version.</a>
					</div>
				</div>
			",
			'section' => 'carpets_and_rugs_slider_section'
		)
	);

	/*
	* Customizer feature bike section
	*/
	/*Project Options*/
	$wp_customize->add_section('carpets_and_rugs_products_section', array(
		'priority'       => 5,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Our Product Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));

	/*Project Enable Option*/
	$wp_customize->add_setting(
		'carpets_and_rugs_enable_product_section',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 0,
			'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
		)
	);

	$wp_customize->add_control(
		'carpets_and_rugs_enable_product_section',
		array(
			'label'       => esc_html__('Enable Product Category Section', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show the product section', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_products_section',
			'type'        => 'checkbox',
		)
	);

	$carpets_and_rugs_args = array(
	    'type'      => 'product',
	    'taxonomy'  => 'product_cat'
	);
	$carpets_and_rugs_categories = get_categories($carpets_and_rugs_args);
	$carpets_and_rugs_cat_posts = array();

	// Add "Select" as the first option
	$carpets_and_rugs_cat_posts['select'] = esc_html__('Select', 'carpets-and-rugs'); // Key must match the default value

	// Loop through categories and populate $carpets_and_rugs_cat_posts
	foreach ($carpets_and_rugs_categories as $carpets_and_rugs_category) {
	    $carpets_and_rugs_cat_posts[$carpets_and_rugs_category->slug] = $carpets_and_rugs_category->name;
	}

	$wp_customize->add_setting('carpets_and_rugs_product_category', array(
	    'default'           => 'product_cat1', // Match the key for "Select"
	    'sanitize_callback' => 'carpets_and_rugs_sanitize_choices',
	));

	$wp_customize->add_control('carpets_and_rugs_product_category', array(
	    'type'    => 'select',
	    'choices' => $carpets_and_rugs_cat_posts,
	    'label'   => esc_html__('Select Product Category', 'carpets-and-rugs'),
	    'section' => 'carpets_and_rugs_products_section',
	));

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

	$wp_customize->add_control(
		'carpets_and_rugs_product_settings_upgraded_features', 
		array(
			'type'=> 'hidden',
			'description' => "
				<div class='customizer-upgraded-features'>
					<span class='pro-head'>Want more product options?</span><br/>
					<span class='pro-text'>						
						<a target='_blank' href='". esc_url(CARPETS_AND_RUGS_BUY_NOW) ." '>Check Carpets and Rugs PRO version.</a>
					</div>
				</div>
			",
			'section' => 'carpets_and_rugs_products_section'
		)
	);

	/*
	* Customizer Footer Section
	*/
	/*Footer Options*/
	$wp_customize->add_section('carpets_and_rugs_footer_section', array(
		'priority'       => 8,
		'capability'     => 'edit_theme_options',
		'theme_supports' => '',
		'title'          => esc_html__('Footer Options', 'carpets-and-rugs'),
		'panel'       => 'carpets_and_rugs_panel',
	));
	
	/*Footer Enable Option*/
	$wp_customize->add_setting(
		'carpets_and_rugs_enable_footer',
		array(
			'capability'        => 'edit_theme_options',
			'transport'         => 'refresh',
			'default'           => 1,
			'sanitize_callback' => 'carpets_and_rugs_sanitize_checkbox',
		)
	);
	$wp_customize->add_control(
		'carpets_and_rugs_enable_footer',
		array(
			'label'       => esc_html__('Enable Footer', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to show Footer', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_footer_section',
			'type'        => 'checkbox',
		)
	);

	/*Footer bg image Option*/
	$wp_customize->add_setting('carpets_and_rugs_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,'carpets_and_rugs_footer_bg_image',array(
        'label' => esc_html__('Footer Background Image','carpets-and-rugs'),
        'section' => 'carpets_and_rugs_footer_section',
    )));

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

    $wp_customize->add_control('carpets_and_rugs_background_attachment', array(
        'label'    => esc_html__('Footer Background Attachment', 'carpets-and-rugs'),
        'section'  => 'carpets_and_rugs_footer_section',
        'settings' => 'carpets_and_rugs_background_attachment',
        'type'     => 'select',
        'choices'  => array(
            'fixed' => esc_html__('fixed','carpets-and-rugs'),
            'scroll' => esc_html__('scroll','carpets-and-rugs'),
        ),
    ));

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

	$wp_customize->add_control(
		'carpets_and_rugs_footer_social_menu',
		array(
			'label'       => esc_html__('Enable Footer Social Menu', 'carpets-and-rugs'),
			'description' => esc_html__('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.', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_footer_section',
			'type'        => 'checkbox',
		)
	);	

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

	$wp_customize->add_control(
		'carpets_and_rugs_enable_go_to_top_option',
		array(
			'label'       => esc_html__('Enable Go To Top', 'carpets-and-rugs'),
			'description' => esc_html__('Checked to enable Go To Top option.', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_footer_section',
			'type'        => 'checkbox',
		)
	);

	$wp_customize->add_setting('carpets_and_rugs_go_to_top_position',array(
        'capability'        => 'edit_theme_options',
		'transport'         => 'refresh',
		'default'           => 'Right',
        'sanitize_callback' => 'carpets_and_rugs_sanitize_choices'
    ));
    $wp_customize->add_control('carpets_and_rugs_go_to_top_position',array(
        'type' => 'select',
        'section' => 'carpets_and_rugs_footer_section',
        'label' => esc_html__('Go To Top Positions','carpets-and-rugs'),
        'choices' => array(
            'Right' => esc_html__('Right','carpets-and-rugs'),
            'Left' => esc_html__('Left','carpets-and-rugs'),
            'Center' => esc_html__('Center','carpets-and-rugs')
        ),
    ) );

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

	$wp_customize->add_control(
		'carpets_and_rugs_copyright_option',
		array(
			'label'       => esc_html__('Edit Copyright Text', 'carpets-and-rugs'),
			'description' => esc_html__('Edit the Footer Copyright Section.', 'carpets-and-rugs'),
			'section'     => 'carpets_and_rugs_footer_section',
			'type'        => 'text',
		)
	);

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

	$wp_customize->add_control(
		'carpets_and_rugs_footer_settings_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(CARPETS_AND_RUGS_BUY_NOW) ." '>Check Carpets and Rugs PRO version.</a>
					</div>
				</div>
			",
			'section' => 'carpets_and_rugs_footer_section'
		)
	);
}
add_action( 'customize_register', 'Carpets_and_Rugs_Customize_register' );

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

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

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function Carpets_and_Rugs_Customize_preview_js() {
	wp_enqueue_script( 'carpets-and-rugs-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), CARPETS_AND_RUGS_VERSION, true );
}
add_action( 'customize_preview_init', 'Carpets_and_Rugs_Customize_preview_js' );

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

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

		static $carpets_and_rugs_instance = null;

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

		return $carpets_and_rugs_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  $carpets_and_rugs_manager
	 * @return void
	*/
	public function sections( $carpets_and_rugs_manager ) {
		// Load custom sections.
		load_template( trailingslashit( get_template_directory() ) . '/revolution/inc/section-pro.php' );

		// Register custom section types.
		$carpets_and_rugs_manager->register_section_type( 'Carpets_and_Rugs_Customize_Section_Pro' );

		// Register sections.
		$carpets_and_rugs_manager->add_section( new Carpets_and_Rugs_Customize_Section_Pro( $carpets_and_rugs_manager,'carpets_and_rugs_go_pro', array(
			'priority'   => 1,
			'title'    => esc_html__( 'Carpets and Rugs', 'carpets-and-rugs' ),
			'pro_text' => esc_html__( 'Buy Pro', 'carpets-and-rugs' ),
			'pro_url'    => esc_url( CARPETS_AND_RUGS_BUY_NOW ),
		) )	);

		// Register sections.
		$carpets_and_rugs_manager->add_section( new Carpets_and_Rugs_Customize_Section_Pro( $carpets_and_rugs_manager,'carpets_and_rugs_doc', array(
			'priority'   => 1,
			'title'    => esc_html__( 'Lite Documentation', 'carpets-and-rugs' ),
			'pro_text' => esc_html__( 'Instruction', 'carpets-and-rugs' ),
			'pro_url'    => esc_url( CARPETS_AND_RUGS_LITE_DOC ),
		) )	);
	}

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

		wp_enqueue_script( 'carpets-and-rugs-customize-controls', trailingslashit( get_template_directory_uri() ) . '/revolution/assets/js/customize-controls.js', array( 'customize-controls' ) );

		wp_enqueue_style( 'carpets-and-rugs-customize-controls', trailingslashit( get_template_directory_uri() ) . '/revolution/assets/css/customize-controls.css' );
	}
}

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