<?php
/**
 * Warehouse Cargo Theme Customizer
 *
 * @link: https://developer.wordpress.org/themes/customize-api/customizer-objects/
 *
 * @package Warehouse Cargo
 */

if ( ! defined( 'WAREHOUSE_CARGO_URL' ) ) {
define('WAREHOUSE_CARGO_URL',__('https://www.themagnifico.net/products/warehouse-wordpress-theme','warehouse-cargo'));
}
if ( ! defined( 'WAREHOUSE_CARGO_BUY_TEXT' ) ) {
    define( 'WAREHOUSE_CARGO_BUY_TEXT', __( 'Buy Warehouse Cargo Pro','warehouse-cargo' ));
}

use WPTRT\Customize\Section\Warehouse_Cargo_Button;

add_action( 'customize_register', function( $manager ) {

    $manager->register_section_type( Warehouse_Cargo_Button::class );

    $manager->add_section(
        new Warehouse_Cargo_Button( $manager, 'warehouse_cargo_pro', [
            'title'       => __( 'Warehouse Cargo Pro', 'warehouse-cargo' ),
            'priority'    => 0,
            'button_text' => __( 'GET PREMIUM', 'warehouse-cargo' ),
            'button_url'  => esc_url( 'https://www.themagnifico.net/products/warehouse-wordpress-theme', 'warehouse-cargo')
        ] )
    );

} );

// Load the JS and CSS.
add_action( 'customize_controls_enqueue_scripts', function() {

    $version = wp_get_theme()->get( 'Version' );

    wp_enqueue_script(
        'warehouse-cargo-customize-section-button',
        get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/js/customize-controls.js' ),
        [ 'customize-controls' ],
        $version,
        true
    );

    wp_enqueue_style(
        'warehouse-cargo-customize-section-button',
        get_theme_file_uri( 'vendor/wptrt/customize-section-button/public/css/customize-controls.css' ),
        [ 'customize-controls' ],
        $version
    );

} );

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function warehouse_cargo_customize_register($wp_customize){

     // Pro Version
    class Warehouse_Cargo_Customize_Pro_Version extends WP_Customize_Control {
        public $type = 'pro_options';

        public function render_content() {
            echo '<span>For More <strong>'. esc_html( $this->label ) .'</strong>?</span>';
            echo '<a href="'. esc_url($this->description) .'" target="_blank">';
                echo '<span class="dashicons dashicons-info"></span>';
                echo '<strong> '. esc_html( WAREHOUSE_CARGO_BUY_TEXT,'warehouse-cargo' ) .'<strong></a>';
            echo '</a>';
        }
    }

    // Custom Controls
    function Warehouse_Cargo_sanitize_custom_control( $input ) {
        return $input;
    }
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';

    //Logo
    $wp_customize->add_setting('warehouse_cargo_logo_max_height',array(
        'default'   => '24',
        'sanitize_callback' => 'warehouse_cargo_sanitize_number_absint'
    ));
    $wp_customize->add_control('warehouse_cargo_logo_max_height',array(
        'label' => esc_html__('Logo Width','warehouse-cargo'),
        'section'   => 'title_tagline',
        'type'      => 'number'
    ));

    $wp_customize->add_setting('warehouse_cargo_logo_title', array(
        'default' => true,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_logo_title',array(
        'label'          => __( 'Enable Disable Title', 'warehouse-cargo' ),
        'section'        => 'title_tagline',
        'settings'       => 'warehouse_cargo_logo_title',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_theme_description', array(
        'default' => false,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_theme_description',array(
        'label'          => __( 'Enable Disable Tagline', 'warehouse-cargo' ),
        'section'        => 'title_tagline',
        'settings'       => 'warehouse_cargo_theme_description',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_logo_title_color', array(
        'default'           => '',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'warehouse_cargo_logo_title_color', array(
        'label'    => __('Site Title Color', 'warehouse-cargo'),
        'section'  => 'title_tagline'
    )));

    $wp_customize->add_setting('warehouse_cargo_logo_tagline_color', array(
        'default'           => '',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'warehouse_cargo_logo_tagline_color', array(
        'label'    => __('Site Tagline Color', 'warehouse-cargo'),
        'section'  => 'title_tagline'
    )));

    // Pro Version
    $wp_customize->add_setting( 'pro_version_logo', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_logo', array(
        'section'     => 'title_tagline',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Theme Color
    $wp_customize->add_section('warehouse_cargo_color_option',array(
        'title' => esc_html__('Theme Color','warehouse-cargo'),
        'priority'   => 10
    ));

    $wp_customize->add_setting( 'warehouse_cargo_theme_color', array(
        'default' => '#fb7b15',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_theme_color', array(
        'label' => esc_html__('First Color Option','warehouse-cargo'),
        'section' => 'warehouse_cargo_color_option',
        'settings' => 'warehouse_cargo_theme_color'
    )));

    $wp_customize->add_setting( 'warehouse_cargo_theme_color_2', array(
        'default' => '#292119',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_theme_color_2', array(
        'label' => esc_html__('Second Color Option','warehouse-cargo'),
        'section' => 'warehouse_cargo_color_option',
        'settings' => 'warehouse_cargo_theme_color_2'
    )));

    // Pro Version
    $wp_customize->add_setting( 'pro_version_theme_color', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_theme_color', array(
        'section'     => 'warehouse_cargo_color_option',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Post Layouts Settings
     $wp_customize->add_section('warehouse_cargo_post_layouts_settings',array(
        'title' => esc_html__('Post Layouts Settings','warehouse-cargo'),
        'priority'   => 30,
    ));

    $wp_customize->add_setting('warehouse_cargo_post_layout',array(
        'default' => 'pattern_two_column_right',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control(new Warehouse_Cargo_Image_Radio_Control($wp_customize, 'warehouse_cargo_post_layout', array(
        'type' => 'select',
        'label' => __('Blog Post Layouts','warehouse-cargo'),
        'section' => 'warehouse_cargo_post_layouts_settings',
        'choices' => array(
            'pattern_one_column' => esc_url(get_template_directory_uri()).'/assets/img/1column.png',
            'pattern_two_column_right' => esc_url(get_template_directory_uri()).'/assets/img/right-sidebar.png',
            'pattern_two_column_left' => esc_url(get_template_directory_uri()).'/assets/img/left-sidebar.png',
            'pattern_three_column' => esc_url(get_template_directory_uri()).'/assets/img/3column.png',
            'pattern_four_column' => esc_url(get_template_directory_uri()).'/assets/img/4column.png',
            'pattern_grid_post' => esc_url(get_template_directory_uri()).'/assets/img/grid.png',
    ))
    ));   

    // General Settings
    $wp_customize->add_section('warehouse_cargo_general_settings',array(
        'title' => esc_html__('General Settings','warehouse-cargo'),
        'priority'   => 30,
    ));

    $wp_customize->add_setting('warehouse_cargo_site_width_layout',array(
        'default' => 'Full Width',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_site_width_layout',array(
        'label'       => esc_html__( 'Site Width Layout','warehouse-cargo' ),
        'type' => 'radio',
        'section' => 'warehouse_cargo_general_settings',
        'choices' => array(
            'Full Width' => __('Full Width','warehouse-cargo'),
            'Wide Width' => __('Wide Width','warehouse-cargo'),
            'Container Width' => __('Container Width','warehouse-cargo')
        ),
    ) );

    $wp_customize->add_setting('warehouse_cargo_preloader_hide', array(
        'default' => 0,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_preloader_hide',array(
        'label'          => __( 'Show Theme Preloader', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_general_settings',
        'settings'       => 'warehouse_cargo_preloader_hide',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_preloader_type',array(
        'default' => 'Preloader 1',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_preloader_type',array(
        'type' => 'radio',
        'label' => esc_html__('Preloader Type','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'choices' => array(
            'Preloader 1' => __('Preloader 1','warehouse-cargo'),
            'Preloader 2' => __('Preloader 2','warehouse-cargo'),
        ),
    ) );

    $wp_customize->add_setting( 'warehouse_cargo_preloader_bg_color', array(
        'default' => '',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_preloader_bg_color', array(
        'label' => esc_html__('Preloader Background Color','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'settings' => 'warehouse_cargo_preloader_bg_color'
    )));

    $wp_customize->add_setting( 'warehouse_cargo_preloader_dot_1_color', array(
        'default' => '#fff',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_preloader_dot_1_color', array(
        'label' => esc_html__('Preloader First Dot Color','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'settings' => 'warehouse_cargo_preloader_dot_1_color',
        'active_callback' => 'warehouse_cargo_preloader1'
    )));

    $wp_customize->add_setting( 'warehouse_cargo_preloader_dot_2_color', array(
        'default' => '#fb7b15',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_preloader_dot_2_color', array(
        'label' => esc_html__('Preloader Second Dot Color','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'settings' => 'warehouse_cargo_preloader_dot_2_color',
        'active_callback' => 'warehouse_cargo_preloader1'
    )));

    $wp_customize->add_setting( 'warehouse_cargo_preloader2_dot_color', array(
        'default' => '',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_preloader2_dot_color', array(
        'label' => esc_html__('Preloader Dot Color','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'settings' => 'warehouse_cargo_preloader2_dot_color',
        'active_callback' => 'warehouse_cargo_preloader2'
    )));

    $wp_customize->add_setting('warehouse_cargo_sticky_header', array(
        'default' => false,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_sticky_header',array(
        'label'          => __( 'Show Sticky Header', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_general_settings',
        'settings'       => 'warehouse_cargo_sticky_header',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_scroll_hide', array(
        'default' => true,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_scroll_hide',array(
        'label'          => __( 'Show Theme Scroll To Top', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_general_settings',
        'settings'       => 'warehouse_cargo_scroll_hide',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_scroll_top_position',array(
        'default' => 'Right',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_scroll_top_position',array(
        'type' => 'radio',
        'label' => __( 'Scroll To Top Position', 'warehouse-cargo' ),
        'section' => 'warehouse_cargo_general_settings',
        'choices' => array(
            'Right' => __('Right','warehouse-cargo'),
            'Left' => __('Left','warehouse-cargo'),
            'Center' => __('Center','warehouse-cargo')
        ),
    ) );

    $wp_customize->add_setting( 'warehouse_cargo_scroll_bg_color', array(
        'default' => '',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_scroll_bg_color', array(
        'label' => esc_html__('Scroll Top Background Color','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'settings' => 'warehouse_cargo_scroll_bg_color'
    )));

    $wp_customize->add_setting( 'warehouse_cargo_scroll_color', array(
        'default' => '',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_scroll_color', array(
        'label' => esc_html__('Scroll Top Color','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'settings' => 'warehouse_cargo_scroll_color'
    )));

    $wp_customize->add_setting('warehouse_cargo_scroll_font_size',array(
        'default'   => '16',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_scroll_font_size',array(
        'label' => __('Scroll Top Font Size','warehouse-cargo'),
        'description' => __('Put in px','warehouse-cargo'),
        'section'   => 'warehouse_cargo_general_settings',
        'type'      => 'number'
    ));

    $wp_customize->add_setting( 'warehouse_cargo_scroll_to_top_border_radius', array(
        'default'              => '',
        'transport'            => 'refresh',
        'sanitize_callback'    => 'warehouse_cargo_sanitize_number_range'
    ) );
    $wp_customize->add_control( 'warehouse_cargo_scroll_to_top_border_radius', array(
        'label'       => esc_html__( 'Scroll To Top Border Radius','warehouse-cargo' ),
        'section'     => 'warehouse_cargo_general_settings',
        'type'        => 'range',
        'input_attrs' => array(
            'step'             => 1,
            'min'              => 1,
            'max'              => 50,
        ),
    ) );

    //Woocommerce shop page Sidebar
    $wp_customize->add_setting('warehouse_cargo_woocommerce_shop_page_sidebar', array(
        'default' => true,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_woocommerce_shop_page_sidebar',array(
        'label'          => __( 'Hide Shop Page Sidebar', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_general_settings',
        'settings'       => 'warehouse_cargo_woocommerce_shop_page_sidebar',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_shop_page_sidebar_layout',array(
        'default' => 'Right Sidebar',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_shop_page_sidebar_layout',array(
        'type' => 'select',
        'label' => __('Woocommerce Shop Page Sidebar','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','warehouse-cargo'),
            'Right Sidebar' => __('Right Sidebar','warehouse-cargo'),
        ),
    ) );

    //Woocommerce Single Product page Sidebar
    $wp_customize->add_setting('warehouse_cargo_woocommerce_single_product_page_sidebar', array(
        'default' => true,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_woocommerce_single_product_page_sidebar',array(
        'label'          => __( 'Hide Single Product Page Sidebar', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_general_settings',
        'settings'       => 'warehouse_cargo_woocommerce_single_product_page_sidebar',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_single_product_sidebar_layout',array(
        'default' => 'Right Sidebar',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_single_product_sidebar_layout',array(
        'type' => 'select',
        'label' => __('Woocommerce Single Product Page Sidebar','warehouse-cargo'),
        'section' => 'warehouse_cargo_general_settings',
        'choices' => array(
            'Left Sidebar' => __('Left Sidebar','warehouse-cargo'),
            'Right Sidebar' => __('Right Sidebar','warehouse-cargo'),
        ),
    ) );

    //Products border radius
    $wp_customize->add_setting( 'warehouse_cargo_woo_product_border_radius', array(
        'default'              => '0',
        'transport'            => 'refresh',
        'sanitize_callback'    => 'warehouse_cargo_sanitize_number_range'
    ) );
    $wp_customize->add_control( 'warehouse_cargo_woo_product_border_radius', array(
        'label'       => esc_html__( 'Product Border Radius','warehouse-cargo' ),
        'section'     => 'warehouse_cargo_general_settings',
        'type'        => 'range',
        'input_attrs' => array(
            'step'             => 1,
            'min'              => 1,
            'max'              => 170,
        ),
    ) );

     // Pro Version
    $wp_customize->add_setting( 'pro_version_general_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_general_setting', array(
        'section'     => 'warehouse_cargo_general_settings',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Top Header
    $wp_customize->add_section('warehouse_cargo_top_header',array(
        'title' => esc_html__('Top Header','warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_top_header_setting', array(
        'default' => 1,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_top_header_setting',array(
        'label'          => __( 'Enable Disable Top Header', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_top_header',
        'settings'       => 'warehouse_cargo_top_header_setting',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_facebook_url',array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_facebook_url',array(
        'label' => esc_html__('Facebook Link','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_facebook_url',
        'type'  => 'url'
    ));

    $wp_customize->add_setting('warehouse_cargo_twitter_url',array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_twitter_url',array(
        'label' => esc_html__('Twitter Link','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_twitter_url',
        'type'  => 'url'
    ));

    $wp_customize->add_setting('warehouse_cargo_intagram_url',array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_intagram_url',array(
        'label' => esc_html__('Intagram Link','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_intagram_url',
        'type'  => 'url'
    ));

    $wp_customize->add_setting('warehouse_cargo_linkedin_url',array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_linkedin_url',array(
        'label' => esc_html__('Linkedin Link','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_linkedin_url',
        'type'  => 'url'
    ));

    $wp_customize->add_setting('warehouse_cargo_pintrest_url',array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_pintrest_url',array(
        'label' => esc_html__('Pinterest Link','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_pintrest_url',
        'type'  => 'url'
    ));

    $wp_customize->add_setting('warehouse_cargo_email_icon',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_email_icon',array(
        'label' => esc_html__('Add Email Icon','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_email_icon',
        'type'  => 'text',
        'default' => 'fas fa-envelope',
        'description' =>  __('Select font awesome icons <a target="_blank" href="https://fontawesome.com/v5/search?m=free">Click Here</a> for select icon. for eg:-fas fa-envelope','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_email',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_email'
    ));
    $wp_customize->add_control('warehouse_cargo_email',array(
        'label' => esc_html__('Add Email','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_email',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_phone_icon',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_phone_icon',array(
        'label' => esc_html__('Add Phone Icon','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_phone_icon',
        'type'  => 'text',
        'default' => 'fas fa-phone',
        'description' =>  __('Select font awesome icons <a target="_blank" href="https://fontawesome.com/v5/search?m=free">Click Here</a> for select icon. for eg:-fas fa-phone','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_phone',array(
        'default' => '',
        'sanitize_callback' => 'warehouse_cargo_sanitize_phone_number'
    ));
    $wp_customize->add_control('warehouse_cargo_phone',array(
        'label' => esc_html__('Add Phone Number','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_phone',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_location_icon',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_location_icon',array(
        'label' => esc_html__('Add Location Icon','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_location_icon',
        'type'  => 'text',
        'default' => 'fas fa-map-marker-alt',
        'description' =>  __('Select font awesome icons <a target="_blank" href="https://fontawesome.com/v5/search?m=free">Click Here</a> for select icon. for eg:-fas fa-map-marker-alt','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_location',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_location',array(
        'label' => esc_html__('Add Location','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_location',
        'type'  => 'text'
    ));
    $wp_customize->add_setting('warehouse_cargo_careers_icon',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_careers_icon',array(
        'label' => esc_html__('Add Careers Icon','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_careers_icon',
        'type'  => 'text',
        'default' => 'fas fa-user',
        'description' =>  __('Select font awesome icons <a target="_blank" href="https://fontawesome.com/v5/search?m=free">Click Here</a> for select icon. for eg:-fas fa-user','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_careers_text',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_careers_text',array(
        'label' => esc_html__('Careers Text','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_careers_text',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_careers_url',array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_careers_url',array(
        'label' => esc_html__('Careers URL','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_careers_url',
        'type'  => 'url'
    ));

    $wp_customize->add_setting('warehouse_cargo_headerbtn_text',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_headerbtn_text',array(
        'label' => esc_html__('Button Text','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_headerbtn_text',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_headerbtn_url',array(
        'default' => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_headerbtn_url',array(
        'label' => esc_html__('Button URL','warehouse-cargo'),
        'section' => 'warehouse_cargo_top_header',
        'setting' => 'warehouse_cargo_headerbtn_url',
        'type'  => 'url'
    ));

     // Pro Version
    $wp_customize->add_setting( 'pro_version_header_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_header_setting', array(
        'section'     => 'warehouse_cargo_top_header',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    //Menu Settings
    $wp_customize->add_section('warehouse_cargo_menu_settings',array(
        'title' => esc_html__('Menus Settings','warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_menu_font_size',array(
        'default' => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_menu_font_size',array(
        'label' => esc_html__('Menu Font Size','warehouse-cargo'),
        'section' => 'warehouse_cargo_menu_settings',
        'type'  => 'number'
    ));

    $wp_customize->add_setting('warehouse_cargo_nav_menu_text_transform',array(
        'default'=> 'Uppercase',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_nav_menu_text_transform',array(
        'type' => 'radio',
        'label' => esc_html__('Menu Text Transform','warehouse-cargo'),
        'choices' => array(
            'Uppercase' => __('Uppercase','warehouse-cargo'),
            'Capitalize' => __('Capitalize','warehouse-cargo'),
            'Lowercase' => __('Lowercase','warehouse-cargo'),
        ),
        'section'=> 'warehouse_cargo_menu_settings',
    ));

    $wp_customize->add_setting('warehouse_cargo_nav_menu_font_weight',array(
        'default'=> '600',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_nav_menu_font_weight',array(
        'type' => 'number',
        'label' => esc_html__('Menu Font Weight','warehouse-cargo'),
        'input_attrs' => array(
            'step'             => 100,
            'min'              => 100,
            'max'              => 1000,
        ),
        'section'=> 'warehouse_cargo_menu_settings',
    ));

    //404 Page Settings
    $wp_customize->add_section('warehouse_cargo_404_page_settings',array(
        'title' => esc_html__(' 404 Page Settings','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_404_page_main_heading',array(
        'default'           => __( 'Oops! Page Not Found', 'warehouse-cargo' ),
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_404_page_main_heading',array(
        'label' => esc_html__('404 Main Heading','warehouse-cargo'),
        'section' => 'warehouse_cargo_404_page_settings',
        'setting' => 'warehouse_cargo_404_page_main_heading',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_404_page_content_1',array(
        'default'           => __( 'We can’t seem to find the page you’re looking for.', 'warehouse-cargo' ),
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_404_page_content_1',array(
        'label' => esc_html__('404 Main Content 1','warehouse-cargo'),
        'section' => 'warehouse_cargo_404_page_settings',
        'setting' => 'warehouse_cargo_404_page_content_1',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_404_page_text_1',array(
        'default'           => __( 'It looks like nothing was found at this location.', 'warehouse-cargo' ),
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_404_page_text_1',array(
        'label' => esc_html__('404 Text 1','warehouse-cargo'),
        'section' => 'warehouse_cargo_404_page_settings',
        'setting' => 'warehouse_cargo_404_page_text_1',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_404_page_content_2',array(
        'default'           => __( 'Need Help?', 'warehouse-cargo' ),
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_404_page_content_2',array(
        'label' => esc_html__('404 Main Content 2','warehouse-cargo'),
        'section' => 'warehouse_cargo_404_page_settings',
        'setting' => 'warehouse_cargo_404_page_content_2',
        'type'  => 'text'
    ));

    $wp_customize->add_setting('warehouse_cargo_404_page_text_2',array(
        'default'           => __( 'Try searching for what you need below.', 'warehouse-cargo' ),
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_404_page_text_2',array(
        'label' => esc_html__('404 Text 2','warehouse-cargo'),
        'section' => 'warehouse_cargo_404_page_settings',
        'setting' => 'warehouse_cargo_404_page_text_2',
        'type'  => 'text'
    ));

    //Slider
    $wp_customize->add_section('warehouse_cargo_top_slider',array(
        'title' => esc_html__('Slider Option','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_slider_setting', array(
        'default' => 1,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_slider_setting',array(
        'label'          => __( 'Enable Disable Slider', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_top_slider',
        'settings'       => 'warehouse_cargo_slider_setting',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_slider_title_setting', array(
        'default' => 1,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_slider_title_setting',array(
        'label'          => __( 'Enable Disable Slider Title', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_top_slider',
        'settings'       => 'warehouse_cargo_slider_title_setting',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_slider_content_setting', array(
        'default' => 1,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_slider_content_setting',array(
        'label'          => __( 'Enable Disable Slider Content', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_top_slider',
        'settings'       => 'warehouse_cargo_slider_content_setting',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_slider_button_setting', array(
        'default' => 1,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_slider_button_setting',array(
        'label'          => __( 'Enable Disable Slider Button', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_top_slider',
        'settings'       => 'warehouse_cargo_slider_button_setting',
        'type'           => 'checkbox',
    )));

    for ( $count = 1; $count <= 3; $count++ ) {
        $wp_customize->add_setting( 'warehouse_cargo_top_slider_page' . $count, array(
            'default'           => '',
            'sanitize_callback' => 'warehouse_cargo_sanitize_dropdown_pages'
        ) );
        $wp_customize->add_control( 'warehouse_cargo_top_slider_page' . $count, array(
            'label'    => __( 'Select Slide Page', 'warehouse-cargo' ),
            'description' => __('Slider image size (1400 x 600)','warehouse-cargo'),
            'section'  => 'warehouse_cargo_top_slider',
            'type'     => 'dropdown-pages'
        ) );
    }

    $wp_customize->add_setting('warehouse_cargo_slider_content_layout',array(
        'default'=> 'Left',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_slider_content_layout',array(
        'type' => 'radio',
        'label' => esc_html__('Slider Content Layout','warehouse-cargo'),
        'choices' => array(
            'Left' => __('Left','warehouse-cargo'),
            'Center' => __('Center','warehouse-cargo'),
            'Right' => __('Right','warehouse-cargo'),
        ),
        'section'=> 'warehouse_cargo_top_slider',
    ));

    $wp_customize->add_setting('warehouse_cargo_slider_excerpt_length',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_number_range',
        'default'  => 25,
    ));
    $wp_customize->add_control('warehouse_cargo_slider_excerpt_length',array(
        'label'       => esc_html__('Slider Excerpt Length', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_top_slider',
        'type'        => 'range',
        'input_attrs' => array(
            'step' => 1,
            'min'  => 1,
            'max'  => 50,
        ),
    ));

    //Slider button text
    $wp_customize->add_setting('warehouse_cargo_slider_button_text',array(
        'default'=> '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_slider_button_text',array(
        'label' => __('Slider Button Text','warehouse-cargo'),
        'section'=> 'warehouse_cargo_top_slider',
        'type'=> 'text'
    ));

    //Slider Image Opacity
    $wp_customize->add_setting('warehouse_cargo_slider_opacity_setting', array(
        'default' => true,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_slider_opacity_setting',array(
        'label'    => __( 'Show Image Opacity', 'warehouse-cargo' ),
        'section'  => 'warehouse_cargo_top_slider',
        'type'     => 'checkbox',
    )));

    $wp_customize->add_setting( 'warehouse_cargo_image_opacity_color', array(
        'default' => '',
        'sanitize_callback' => 'sanitize_hex_color'
    ));
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'warehouse_cargo_image_opacity_color', array(
        'label' => __('Slider Image Opacity Color', 'warehouse-cargo'),
        'section' => 'warehouse_cargo_top_slider',
        'settings' => 'warehouse_cargo_image_opacity_color',
    )));

    $wp_customize->add_setting('warehouse_cargo_slider_opacity',array(
        'default'=> '0.5',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_slider_opacity',array(
        'type' => 'select',
        'label' => esc_html__('Slider Image Opacity','warehouse-cargo'),
        'choices' => array(
            '0'   => '0',
            '0.1' => '0.1',
            '0.2' => '0.2',
            '0.3' => '0.3',
            '0.4' => '0.4',
            '0.5' => '0.5',
            '0.6' => '0.6',
            '0.7' => '0.7',
            '0.8' => '0.8',
            '0.9' => '0.9',
            '1'   => '1',
        ),
        'section'=> 'warehouse_cargo_top_slider',
    ));

    //Slider height
    $wp_customize->add_setting('warehouse_cargo_slider_img_height',array(
        'default'=> '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_slider_img_height',array(
        'label' => __('Slider Height','warehouse-cargo'),
        'description'   => __('Add the slider height in px(eg. 500px).','warehouse-cargo'),
        'input_attrs' => array(
            'placeholder' => __( '500px', 'warehouse-cargo' ),
        ),
        'section'=> 'warehouse_cargo_top_slider',
        'type'=> 'text'
    ));

     // Pro Version
    $wp_customize->add_setting( 'pro_version_slider_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_slider_setting', array(
        'section'     => 'warehouse_cargo_top_slider',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Details Section
    $wp_customize->add_section('warehouse_cargo_details_section',array(
        'title' => esc_html__('Contact Details Section','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_home_contact_setting', array(
        'default' => 1,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_home_contact_setting',array(
        'label'          => __( 'Enable Disable Contact', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_details_section',
        'settings'       => 'warehouse_cargo_home_contact_setting',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_detail_call_heading',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_call_heading',array(
        'label' => esc_html__('Call Center Heading','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_call_text',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_call_text',array(
        'label' => esc_html__('Calling Number','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_working_heading',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_working_heading',array(
        'label' => esc_html__('Working Hour Heading','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_working_text',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_working_text',array(
        'label' => esc_html__('Timming','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_location_heading',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_location_heading',array(
        'label' => esc_html__('Location Heading','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_location_text',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_location_text',array(
        'label' => esc_html__('Location','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_quote_heading',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_quote_heading',array(
        'label' => esc_html__('Detailed Quote Heading','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_quote_text',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_quote_text',array(
        'label' => esc_html__('Button Text','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_detail_quote_url',array(
        'default'   => '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('warehouse_cargo_detail_quote_url',array(
        'label' => esc_html__('Button URL','warehouse-cargo'),
        'section'   => 'warehouse_cargo_details_section',
        'type'      => 'url',
    ));

     // Pro Version
    $wp_customize->add_setting( 'pro_version_details_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_details_setting', array(
        'section'     => 'warehouse_cargo_details_section',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Latest Post Section
    $wp_customize->add_section('warehouse_cargo_latest_post',array(
        'title' => esc_html__('Latest Post Section','warehouse-cargo')
    ));

    $wp_customize->add_setting('warehouse_cargo_latest_post_setting', array(
        'default' => 1,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'warehouse_cargo_latest_post_setting',array(
        'label'          => __( 'Enable Disable Latest Post', 'warehouse-cargo' ),
        'section'        => 'warehouse_cargo_latest_post',
        'settings'       => 'warehouse_cargo_latest_post_setting',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('warehouse_cargo_latest_post_loop',array(
        'default'   => '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('warehouse_cargo_latest_post_loop',array(
        'label' => esc_html__('No of latest post','warehouse-cargo'),
        'section'   => 'warehouse_cargo_latest_post',
        'type'      => 'number',
        'input_attrs' => array(
            'step'             => 1,
            'min'              => 0,
            'max'              => 12,
        ),
    ));

    $latest_post_loop = get_theme_mod('warehouse_cargo_latest_post_loop');

    $warehouse_cargo_args = array('numberposts' => -1);
    $post_list = get_posts($warehouse_cargo_args);
    $i = 1;
    $pst_sls[]= __('Select','warehouse-cargo');
    foreach ($post_list as $key => $p_post) {
        $pst_sls[$p_post->ID]=$p_post->post_title;
    }
    for ( $i = 1; $i <= $latest_post_loop; $i++ ) {
        $wp_customize->add_setting('warehouse_cargo_other_latest_post_section'.$i,array(
            'sanitize_callback' => 'warehouse_cargo_sanitize_choices',
        ));
        $wp_customize->add_control('warehouse_cargo_other_latest_post_section'.$i,array(
            'type'    => 'select',
            'choices' => $pst_sls,
            'label' => __('Select Post','warehouse-cargo'),
            'section' => 'warehouse_cargo_latest_post',
        ));
    }
    wp_reset_postdata();

     // Pro Version
    $wp_customize->add_setting( 'pro_version_latest_post_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_latest_post_setting', array(
        'section'     => 'warehouse_cargo_latest_post',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Footer
    $wp_customize->add_section('warehouse_cargo_site_footer_section', array(
        'title' => esc_html__('Footer', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_footer_bg_image',array(
        'default'   => '',
        'sanitize_callback' => 'esc_url_raw',
    ));
    $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'warehouse_cargo_footer_bg_image',array(
        'label' => __('Footer Background Image','warehouse-cargo'),
        'section' => 'warehouse_cargo_site_footer_section',
        'priority' => 1,
    )));

    $wp_customize->add_setting('warehouse_cargo_footer_bg_image_position',array(
        'default'=> 'scroll',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_footer_bg_image_position',array(
        'type' => 'select',
        'label' => __('Footer Background Image Position','warehouse-cargo'),
        'choices' => array(
            'fixed' => __('fixed','warehouse-cargo'),
            'scroll' => __('scroll','warehouse-cargo'),
        ),
        'section'=> 'warehouse_cargo_site_footer_section',
    ));

    $wp_customize->add_setting('warehouse_cargo_footer_widget_heading_alignment',array(
        'default' => 'Left',
        'transport' => 'refresh',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_footer_widget_heading_alignment',array(
        'type' => 'select',
        'label' => __('Footer Widget Heading Alignment','warehouse-cargo'),
        'section' => 'warehouse_cargo_site_footer_section',
        'choices' => array(
            'Left' => __('Left','warehouse-cargo'),
            'Center' => __('Center','warehouse-cargo'),
            'Right' => __('Right','warehouse-cargo')
        ),
    ) );

    $wp_customize->add_setting('warehouse_cargo_footer_widget_content_alignment',array(
        'default' => 'Left',
        'transport' => 'refresh',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_footer_widget_content_alignment',array(
        'type' => 'select',
        'label' => __('Footer Widget Content Alignment','warehouse-cargo'),
        'section' => 'warehouse_cargo_site_footer_section',
        'choices' => array(
            'Left' => __('Left','warehouse-cargo'),
            'Center' => __('Center','warehouse-cargo'),
            'Right' => __('Right','warehouse-cargo')
        ),
    ) );

    $wp_customize->add_setting('warehouse_cargo_show_hide_copyright',array(
        'default' => true,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control('warehouse_cargo_show_hide_copyright',array(
        'type' => 'checkbox',
        'label' => __('Show / Hide Copyright','warehouse-cargo'),
        'section' => 'warehouse_cargo_site_footer_section',
    ));

    $wp_customize->add_setting('warehouse_cargo_footer_text_setting', array(
        'sanitize_callback' => 'sanitize_text_field',
    ));
    $wp_customize->add_control('warehouse_cargo_footer_text_setting', array(
        'label' => __('Replace the footer text', 'warehouse-cargo'),
        'section' => 'warehouse_cargo_site_footer_section',
        'type' => 'text',
    ));

    $wp_customize->add_setting('warehouse_cargo_copyright_content_alignment',array(
        'default' => 'Center',
        'transport' => 'refresh',
        'sanitize_callback' => 'warehouse_cargo_sanitize_choices'
    ));
    $wp_customize->add_control('warehouse_cargo_copyright_content_alignment',array(
        'type' => 'select',
        'label' => __('Copyright Content Alignment','warehouse-cargo'),
        'section' => 'warehouse_cargo_site_footer_section',
        'choices' => array(
            'Left' => __('Left','warehouse-cargo'),
            'Center' => __('Center','warehouse-cargo'),
            'Right' => __('Right','warehouse-cargo')
        ),
    ) );

    $wp_customize->add_setting('warehouse_cargo_copyright_background_color', array(
        'default'           => '',
        'sanitize_callback' => 'sanitize_hex_color',
    ));
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'warehouse_cargo_copyright_background_color', array(
        'label'    => __('Copyright Background Color', 'warehouse-cargo'),
        'section'  => 'warehouse_cargo_site_footer_section',
    )));

    // Pro Version
    $wp_customize->add_setting( 'pro_version_footer_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_footer_setting', array(
        'section'     => 'warehouse_cargo_site_footer_section',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Post Settings
     $wp_customize->add_section('warehouse_cargo_post_settings',array(
        'title' => esc_html__('Post Settings','warehouse-cargo'),
        'priority'   =>40,
    ));

    $wp_customize->add_setting('warehouse_cargo_post_page_title',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_post_page_title',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Post Page Title', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable title on post page.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_post_page_thumb',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_post_page_thumb',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Post Page Thumbnail', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable thumbnail on post page.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_post_page_btn',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_post_page_btn',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Post Page Button', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable button on post page.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_post_page_content',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_post_page_content',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Post Page Content', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable content on post page.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_post_page_excerpt_length',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_number_range',
        'default'           => 30,
    ));
    $wp_customize->add_control('warehouse_cargo_post_page_excerpt_length',array(
        'label'       => esc_html__('Post Page Excerpt Length', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'type'        => 'range',
        'input_attrs' => array(
            'step'             => 1,
            'min'              => 1,
            'max'              => 50,
        ),
    ));

    $wp_customize->add_setting('warehouse_cargo_post_page_excerpt_suffix',array(
        'sanitize_callback' => 'sanitize_text_field',
        'default'           => '[...]',
    ));
    $wp_customize->add_control('warehouse_cargo_post_page_excerpt_suffix',array(
        'type'        => 'text',
        'label'       => esc_html__('Post Page Excerpt Suffix', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('For Ex. [...], etc', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_post_page_pagination',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_post_page_pagination',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Post Page Pagination', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable pagination on post page.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_single_post_thumb',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_single_post_thumb',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Single Post Thumbnail', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable post thumbnail on single post.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting( 'warehouse_cargo_single_post_page_image_border_radius', array(
        'default'              => '0',
        'transport'            => 'refresh',
        'sanitize_callback'    => 'warehouse_cargo_sanitize_number_range'
    ) );
    $wp_customize->add_control( 'warehouse_cargo_single_post_page_image_border_radius', array(
        'label'       => esc_html__( 'Single Post Page Image Border Radius','warehouse-cargo' ),
        'section'     => 'warehouse_cargo_post_settings',
        'type'        => 'range',
        'input_attrs' => array(
            'step'             => 1,
            'min'              => 1,
            'max'              => 50,
        ),
    ) );

    $wp_customize->add_setting( 'warehouse_cargo_single_post_page_image_box_shadow', array(
        'default'              => '0',
        'transport'            => 'refresh',
        'sanitize_callback'    => 'warehouse_cargo_sanitize_number_range'
    ) );
    $wp_customize->add_control( 'warehouse_cargo_single_post_page_image_box_shadow', array(
        'label'       => esc_html__( 'Single Post Page Image Box Shadow','warehouse-cargo' ),
        'section'     => 'warehouse_cargo_post_settings',
        'type'        => 'range',
        'input_attrs' => array(
            'step'             => 1,
            'min'              => 1,
            'max'              => 50,
        ),
    ) );

    $wp_customize->add_setting('warehouse_cargo_single_post_title',array(
            'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
            'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_single_post_title',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Single Post Title', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable title on single post.', 'warehouse-cargo'),
    ));

     $wp_customize->add_setting('warehouse_cargo_single_post_page_content',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_single_post_page_content',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Single Post Page Content', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_post_settings',
        'description' => esc_html__('Check this box to enable content on single post page.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_single_post_navigation_show_hide',array(
        'default' => true,
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox'
    ));
    $wp_customize->add_control('warehouse_cargo_single_post_navigation_show_hide',array(
        'type' => 'checkbox',
        'label' => __('Show / Hide Post Navigation','warehouse-cargo'),
        'section' => 'warehouse_cargo_post_settings',
    ));

    // Pro Version
    $wp_customize->add_setting( 'pro_version_post_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_post_setting', array(
        'section'     => 'warehouse_cargo_post_settings',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));

    // Page Settings
    $wp_customize->add_section('warehouse_cargo_page_settings',array(
        'title' => esc_html__('Page Settings','warehouse-cargo'),
        'priority'   =>50,
    ));

    $wp_customize->add_setting('warehouse_cargo_single_page_title',array(
            'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
            'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_single_page_title',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Single Page Title', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_page_settings',
        'description' => esc_html__('Check this box to enable title on single page.', 'warehouse-cargo'),
    ));

    $wp_customize->add_setting('warehouse_cargo_single_page_thumb',array(
        'sanitize_callback' => 'warehouse_cargo_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('warehouse_cargo_single_page_thumb',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Enable Single Page Thumbnail', 'warehouse-cargo'),
        'section'     => 'warehouse_cargo_page_settings',
        'description' => esc_html__('Check this box to enable page thumbnail on single page.', 'warehouse-cargo'),
    ));

    // Pro Version
    $wp_customize->add_setting( 'pro_version_single_page_setting', array(
        'sanitize_callback' => 'Warehouse_Cargo_sanitize_custom_control'
    ));
    $wp_customize->add_control( new Warehouse_Cargo_Customize_Pro_Version ( $wp_customize,'pro_version_single_page_setting', array(
        'section'     => 'warehouse_cargo_page_settings',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Customizer Options', 'warehouse-cargo' ),
        'description' => esc_url( WAREHOUSE_CARGO_URL ),
        'priority'    => 100
    )));
     
}
add_action('customize_register', 'warehouse_cargo_customize_register');

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

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

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function warehouse_cargo_customize_preview_js(){
    wp_enqueue_script('warehouse-cargo-customizer', esc_url(get_template_directory_uri()) . '/assets/js/customizer.js', array('customize-preview'), '20151215', true);
}
add_action('customize_preview_init', 'warehouse_cargo_customize_preview_js');

/*
** Load dynamic logic for the customizer controls area.
*/
function warehouse_cargo_panels_js() {
    wp_enqueue_style( 'warehouse-cargo-customizer-layout-css', get_theme_file_uri( '/assets/css/customizer-layout.css' ) );
    wp_enqueue_script( 'warehouse-cargo-customize-layout', get_theme_file_uri( '/assets/js/customize-layout.js' ), array(), '1.2', true );
}
add_action( 'customize_controls_enqueue_scripts', 'warehouse_cargo_panels_js' );

