<?php
/**
 * Ebooks Collection Theme Customizer
 *
 * @package Ebooks Collection
 */

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

	function ebooks_collection_sanitize_dropdown_pages( $page_id, $setting ) {
  		$page_id = absint( $page_id );
  		return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default );
	}

	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';

	wp_enqueue_style('ebooks-collection-customize-controls', trailingslashit(esc_url(get_template_directory_uri())).'/css/customize-controls.css');

	if ( class_exists( 'WP_Customize_Control' ) ) {
		require_once get_template_directory() . '/inc/customizer-custom-controls.php';
	}

	// Enable / Disable Logo
	$wp_customize->add_setting('ebooks_collection_logo_enable',array(
		'default' => true,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control( 'ebooks_collection_logo_enable', array(
		'settings' => 'ebooks_collection_logo_enable',
		'section'   => 'title_tagline',
		'label'     => __('Enable Logo','ebooks-collection'),
		'type'      => 'checkbox'
	));

	//Logo
    $wp_customize->add_setting('ebooks_collection_logo_width',array(
		'default'=> '',
		'transport' => 'refresh',
		'sanitize_callback' => 'ebooks_collection_sanitize_integer'
	));
	$wp_customize->add_control(new Ebooks_Collection_Slider_Custom_Control( $wp_customize, 'ebooks_collection_logo_width',array(
		'label'	=> esc_html__('Logo Width','ebooks-collection'),
		'section'=> 'title_tagline',
		'settings'=>'ebooks_collection_logo_width',
		'input_attrs' => array(
            'step'             => 1,
			'min'              => 0,
			'max'              => 300,
        ),
	)));

	// color site title
	$wp_customize->add_setting('ebooks_collection_sitetitle_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_sitetitle_color', array(
	   'settings' => 'ebooks_collection_sitetitle_color',
	   'section'   => 'title_tagline',
	   'label' => __('Site Title Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

	$wp_customize->add_setting('ebooks_collection_title_enable',array(
		'default' => false,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control( 'ebooks_collection_title_enable', array(
	   'settings' => 'ebooks_collection_title_enable',
	   'section'   => 'title_tagline',
	   'label'     => __('Enable Site Title','ebooks-collection'),
	   'type'      => 'checkbox'
	));

	// color site tagline
	$wp_customize->add_setting('ebooks_collection_sitetagline_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_sitetagline_color', array(
	   'settings' => 'ebooks_collection_sitetagline_color',
	   'section'   => 'title_tagline',
	   'label' => __('Site Tagline Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

	$wp_customize->add_setting('ebooks_collection_tagline_enable',array(
		'default' => false,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control( 'ebooks_collection_tagline_enable', array(
	   'settings' => 'ebooks_collection_tagline_enable',
	   'section'   => 'title_tagline',
	   'label'     => __('Enable Site Tagline','ebooks-collection'),
	   'type'      => 'checkbox'
	));

	// woocommerce section
	$wp_customize->add_section('ebooks_collection_woocommerce_page_settings', array(
		'title'    => __('WooCommerce Page Settings', 'ebooks-collection'),
		'priority' => null,
		'panel'    => 'woocommerce',
	));

	$wp_customize->add_setting('ebooks_collection_shop_page_sidebar',array(
		'default' => false,
		'sanitize_callback'	=> 'ebooks_collection_sanitize_checkbox'
	));
	$wp_customize->add_control('ebooks_collection_shop_page_sidebar',array(
		'type' => 'checkbox',
		'label' => __(' Check To Enable Shop page sidebar','ebooks-collection'),
		'section' => 'ebooks_collection_woocommerce_page_settings',
	));

    // shop page sidebar alignment
    $wp_customize->add_setting('ebooks_collection_shop_page_sidebar_position', array(
		'default'           => 'Right Sidebar',
		'sanitize_callback' => 'ebooks_collection_sanitize_choices',
	));
	$wp_customize->add_control('ebooks_collection_shop_page_sidebar_position',array(
		'type'           => 'radio',
		'label'          => __('Shop Page Sidebar', 'ebooks-collection'),
		'section'        => 'ebooks_collection_woocommerce_page_settings',
		'choices'        => array(
			'Left Sidebar'  => __('Left Sidebar', 'ebooks-collection'),
			'Right Sidebar' => __('Right Sidebar', 'ebooks-collection'),
		),
	));	 

	$wp_customize->add_setting('ebooks_collection_wooproducts_nav',array(
		'default' => 'Yes',
		'sanitize_callback'	=> 'ebooks_collection_sanitize_choices'
	 ));
	 $wp_customize->add_control('ebooks_collection_wooproducts_nav',array(
		'type' => 'select',
		'label' => __('Shop Page Products Navigation','ebooks-collection'),
		'choices' => array(
			 'Yes' => __('Yes','ebooks-collection'),
			 'No' => __('No','ebooks-collection'),
		 ),
		'section' => 'ebooks_collection_woocommerce_page_settings',
	));

	$wp_customize->add_setting( 'ebooks_collection_single_page_sidebar',array(
		'default' => false,
		'sanitize_callback'	=> 'ebooks_collection_sanitize_checkbox'
    ) );
    $wp_customize->add_control('ebooks_collection_single_page_sidebar',array(
    	'type' => 'checkbox',
       	'label' => __('Check To Enable Single Product Page Sidebar','ebooks-collection'),
		'section' => 'ebooks_collection_woocommerce_page_settings'
    ));

	// single product page sidebar alignment
    $wp_customize->add_setting('ebooks_collection_single_product_page_layout', array(
		'default'           => 'Right Sidebar',
		'sanitize_callback' => 'ebooks_collection_sanitize_choices',
	));
	$wp_customize->add_control('ebooks_collection_single_product_page_layout',array(
		'type'           => 'radio',
		'label'          => __('Single product Page Sidebar', 'ebooks-collection'),
		'section'        => 'ebooks_collection_woocommerce_page_settings',
		'choices'        => array(
			'Left Sidebar'  => __('Left Sidebar', 'ebooks-collection'),
			'Right Sidebar' => __('Right Sidebar', 'ebooks-collection'),
		),
	));

	$wp_customize->add_setting('ebooks_collection_related_product_enable',array(
		'default' => true,
		'sanitize_callback'	=> 'ebooks_collection_sanitize_checkbox'
	));
	$wp_customize->add_control('ebooks_collection_related_product_enable',array(
		'type' => 'checkbox',
		'label' => __('Check To Enable Related product','ebooks-collection'),
		'section' => 'ebooks_collection_woocommerce_page_settings',
	));

	$wp_customize->add_setting( 'ebooks_collection_woo_product_img_border_radius', array(
        'default'              => '0',
        'transport'            => 'refresh',
        'sanitize_callback'    => 'ebooks_collection_sanitize_integer'
    ) );
    $wp_customize->add_control(new Ebooks_Collection_Slider_Custom_Control( $wp_customize, 'ebooks_collection_woo_product_img_border_radius',array(
		'label'	=> esc_html__('Product Img Border Radius','ebooks-collection'),
		'section'=> 'ebooks_collection_woocommerce_page_settings',
		'settings'=>'ebooks_collection_woo_product_img_border_radius',
		'input_attrs' => array(
            'step'             => 1,
			'min'              => 0,
			'max'              => 100,
        ),
	)));

	// Add a setting for number of products per row
	$wp_customize->add_setting('ebooks_collection_products_per_row', array(
     	'default'   => '4',
    	'transport' => 'refresh',
	   'sanitize_callback' => 'ebooks_collection_sanitize_integer'
	));
	$wp_customize->add_control('ebooks_collection_products_per_row', array(
	    'label'    => __('Products Per Row', 'ebooks-collection'),
	    'section'  => 'ebooks_collection_woocommerce_page_settings',
	    'settings' => 'ebooks_collection_products_per_row',
	    'type'     => 'select',
	   'choices'  => array(
	    	'2' => '2',
		    '3' => '3',
		   '4' => '4',
	   ),
	) );

	// Add a setting for the number of products per page
	$wp_customize->add_setting('ebooks_collection_products_per_page', array(
    	'default'   => '9',
    	'transport' => 'refresh',
	    'sanitize_callback' => 'ebooks_collection_sanitize_integer'
	));
	$wp_customize->add_control('ebooks_collection_products_per_page', array(
	   'label'    => __('Products Per Page', 'ebooks-collection'),
	   'section'  => 'ebooks_collection_woocommerce_page_settings',
	   'settings' => 'ebooks_collection_products_per_page',
	   'type'     => 'number',
	   'input_attrs' => array(
		     'min'  => 1,
		    'step' => 1,
	),
	));

    $wp_customize->add_setting('ebooks_collection_product_sale_position',array(
        'default' => 'Left',
        'sanitize_callback' => 'ebooks_collection_sanitize_choices'
	));
	$wp_customize->add_control('ebooks_collection_product_sale_position',array(
        'type' => 'radio',
        'label' => __('Product Sale Position','ebooks-collection'),
        'section' => 'ebooks_collection_woocommerce_page_settings',
        'choices' => array(
            'Left' => __('Left','ebooks-collection'),
            'Right' => __('Right','ebooks-collection'),
        ),
	) );  	

	//Theme Options
	$wp_customize->add_panel( 'ebooks_collection_panel_area', array(
		'priority' => 10,
		'capability' => 'edit_theme_options',
		'title' => __( 'Theme Options Panel', 'ebooks-collection' ),
	));

	//Site Layout Section
	$wp_customize->add_section('ebooks_collection_site_layoutsec',array(
		'title'	=> __('Manage Site Layout Section ','ebooks-collection'),
		'description' => __('<p class="sec-title">Manage Site Layout Section</p>','ebooks-collection'),
		'priority'	=> 1,
		'panel' => 'ebooks_collection_panel_area',
	));	

	$wp_customize->add_setting('ebooks_collection_preloader',array(
		'default' => false,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control( 'ebooks_collection_preloader', array(
	   'section'   => 'ebooks_collection_site_layoutsec',
	   'label'	=> __('Check to Show preloader','ebooks-collection'),
	   'type'      => 'checkbox'
 	));

	$wp_customize->add_setting('ebooks_collection_preloader_bg_image',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw',
	));
	$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'ebooks_collection_preloader_bg_image',array(
        'section' => 'ebooks_collection_site_layoutsec',
		'label' => __('Preloader Background Image','ebooks-collection'),
	)));

	$wp_customize->add_setting('ebooks_collection_box_layout',array(
		'default' => false,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control( 'ebooks_collection_box_layout', array(
	   'section'   => 'ebooks_collection_site_layoutsec',
	   'label'	=> __('Check to Show Box Layout','ebooks-collection'),
	   'type'      => 'checkbox'
 	));

   // Add Settings and Controls for Page Layout
    $wp_customize->add_setting('ebooks_collection_sidebar_page_layout',array(
		'default' => 'full',
	 	'sanitize_callback' => 'ebooks_collection_sanitize_choices'
	));
	$wp_customize->add_control('ebooks_collection_sidebar_page_layout',array(
		'type' => 'radio',
		'label'     => __('Theme Page Sidebar Position', 'ebooks-collection'),
		'section' => 'ebooks_collection_site_layoutsec',
		'choices' => array(
			'left' => __('Left','ebooks-collection'),
			'right' => __('Right','ebooks-collection'),
			'full' => __('No Sidebar','ebooks-collection')
	),
	));	

	$wp_customize->add_setting( 'ebooks_collection_layout_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_layout_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		<a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_site_layoutsec'
	));		
	
	//Global Color
	$wp_customize->add_section('ebooks_collection_global_color', array(
		'title'    => __('Manage Global Color Section', 'ebooks-collection'),
		'panel'    => 'ebooks_collection_panel_area',
	));

	$wp_customize->add_setting('ebooks_collection_first_color', array(
		'default'           => '#00b965',
		'sanitize_callback' => 'sanitize_hex_color',
	));
	$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'ebooks_collection_first_color', array(
		'label'    => __('Theme Color', 'ebooks-collection'),
		'section'  => 'ebooks_collection_global_color',
		'settings' => 'ebooks_collection_first_color',
	)));	

	$wp_customize->add_setting('ebooks_collection_second_color', array(
		'default'           => '#2d2d2d',
		'sanitize_callback' => 'sanitize_hex_color',
	));
	$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'ebooks_collection_second_color', array(
		'label'    => __('Theme Color', 'ebooks-collection'),
		'section'  => 'ebooks_collection_global_color',
		'settings' => 'ebooks_collection_second_color',
	)));	

	$wp_customize->add_setting( 'ebooks_collection_global_color_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_global_color_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		<a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_global_color'
	));	

 	// Header Section
	$wp_customize->add_section('ebooks_collection_header_section', array(
        'title' => __('Manage Header Section', 'ebooks-collection'),
		'description' => __('<p class="sec-title">Manage Header Section</p>','ebooks-collection'),
        'priority' => null,
		'panel' => 'ebooks_collection_panel_area',
 	));

 	$wp_customize->add_setting('ebooks_collection_stickyheader',array(
		'default' => false,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control( 'ebooks_collection_stickyheader', array(
	   'section'   => 'ebooks_collection_header_section',
	   'label'	=> __('Check To Show Sticky Header','ebooks-collection'),
	   'type'      => 'checkbox'
 	));

	// header menu
	$wp_customize->add_setting('ebooks_collection_menu_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_menu_color', array(
	   'settings' => 'ebooks_collection_menu_color',
	   'section'   => 'ebooks_collection_header_section',
	   'label' => __('Menu Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

	// header menu hover color
	$wp_customize->add_setting('ebooks_collection_menuhrv_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_menuhrv_color', array(
	   'settings' => 'ebooks_collection_menuhrv_color',
	   'section'   => 'ebooks_collection_header_section',
	   'label' => __('Menu Hover Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

	// header sub menu color
	$wp_customize->add_setting('ebooks_collection_submenu_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_submenu_color', array(
	   'settings' => 'ebooks_collection_submenu_color',
	   'section'   => 'ebooks_collection_header_section',
	   'label' => __('SubMenu Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

	// header sub menu hover color
	$wp_customize->add_setting('ebooks_collection_submenuhrv_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_submenuhrv_color', array(
	   'settings' => 'ebooks_collection_submenuhrv_color',
	   'section'   => 'ebooks_collection_header_section',
	   'label' => __('SubMenu Hover Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

    // Menu Text Transform
    $wp_customize->add_setting( 'ebooks_collection_menu_text_transform', array(
        'default'           => 'Capitalize',
		'transport' => 'refresh',
		'sanitize_callback' => 'ebooks_collection_sanitize_choices'
    ));

    $wp_customize->add_control( 'ebooks_collection_menu_text_transform', array(
        'label'    => __( 'Menu Text Transform', 'ebooks-collection' ),
        'section'  => 'ebooks_collection_header_section',
        'type'     => 'select',
        'choices'  => array(
			'None'       => __( 'None', 'ebooks-collection' ),
            'Capitalize' => __( 'Capitalize', 'ebooks-collection' ),
            'Uppercase'  => __( 'Uppercase', 'ebooks-collection' ),
            'Lowercase'  => __( 'Lowercase', 'ebooks-collection' ),
        ),
    ));

	$wp_customize->add_setting( 'ebooks_collection_header_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_header_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		<a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_header_section'
	));	

	//Slider
  	$wp_customize->add_section('ebooks_collection_slider_section',array(
	    'title' => __('Manage Slider Section','ebooks-collection'),
	    'priority'  => null,
	    'description'	=> __('<p class="sec-title">Manage Slider Section</p> Select Category from the Dropdowns for slider, Also use the given image dimension (650 x 300).','ebooks-collection'),
	    'panel' => 'ebooks_collection_panel_area',
	));

	$wp_customize->add_setting('ebooks_collection_slider',array(
		'default' => false,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_slider', array(
	   'settings' => 'ebooks_collection_slider',
	   'section'   => 'ebooks_collection_slider_section',
	   'label'     => __('Check To Enable This Section','ebooks-collection'),
	   'type'      => 'checkbox'
	));

	$categories = get_categories();
	$cats = array();
	$i = 0;
	$cat_post[]= 'select';
	foreach($categories as $category){
		if($i==0){
			$default = $category->slug;
			$i++;
		}
		$cat_post[$category->slug] = $category->name;
	}

    $wp_customize->add_setting('ebooks_collection_slider_cat',array(
	    'default' => '0',
	    'sanitize_callback' => 'ebooks_collection_sanitize_choices',
  	));
  	$wp_customize->add_control('ebooks_collection_slider_cat',array(
	    'type'    => 'select',
	    'choices' => $cat_post,
	    'label' => __('Select Category to display Latest Post','ebooks-collection'),
	    'section' => 'ebooks_collection_slider_section',
	));

	$wp_customize->add_setting('ebooks_collection_button_text',array(
		'default' => 'Learn More',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_button_text', array(
	   'settings' => 'ebooks_collection_button_text',
	   'section'   => 'ebooks_collection_slider_section',
	   'label' => __('Add Button Text 1', 'ebooks-collection'),
	   'type'      => 'text'
	));

	$wp_customize->add_setting('ebooks_collection_button_link_slider',array(
        'default'=> '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('ebooks_collection_button_link_slider',array(
        'label' => esc_html__('Add Button Link 1','ebooks-collection'),
        'section'=> 'ebooks_collection_slider_section',
        'type'=> 'url'
    ));

    $wp_customize->add_setting('ebooks_collection_button_text2',array(
		'default' => 'Shop Now',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_button_text2', array(
	   'settings' => 'ebooks_collection_button_text2',
	   'section'   => 'ebooks_collection_slider_section',
	   'label' => __('Add Button Text 2', 'ebooks-collection'),
	   'type'      => 'text'
	));

	$wp_customize->add_setting('ebooks_collection_button_link_slider2',array(
        'default'=> '',
        'sanitize_callback' => 'esc_url_raw'
    ));
    $wp_customize->add_control('ebooks_collection_button_link_slider2',array(
        'label' => esc_html__('Add Button Link 2','ebooks-collection'),
        'section'=> 'ebooks_collection_slider_section',
        'type'=> 'url'
    ));

    //Slider height
    $wp_customize->add_setting('ebooks_collection_slider_img_height',array(
        'default'=> '',
        'sanitize_callback' => 'sanitize_text_field'
    ));
    $wp_customize->add_control('ebooks_collection_slider_img_height',array(
        'label' => __('Slider Image Height','ebooks-collection'),
        'description'   => __('Add the slider image height here (eg. 600px)','ebooks-collection'),
        'input_attrs' => array(
            'placeholder' => __( '500px', 'ebooks-collection' ),
        ),
        'section'=> 'ebooks_collection_slider_section',
        'type'=> 'text'
    ));

    $wp_customize->add_setting( 'ebooks_collection_slider_settings_upgraded_features',array(
    'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_slider_settings_upgraded_features', array(
	    'type'=> 'hidden',
	    'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
	        <a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
	    'section' => 'ebooks_collection_slider_section'
	));

	// About Section 
	$wp_customize->add_section('ebooks_collection_features_section', array(
		'title'	=> __('Manage Our Features Section','ebooks-collection'),
		'description'	=> __('<p class="sec-title">Manage Our Features Section</p>','ebooks-collection'),
		'priority'	=> null,
		'panel' => 'ebooks_collection_panel_area',
	));
	
	$wp_customize->add_setting('ebooks_collection_disabled_pgboxes',array(
		'default' => false,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_disabled_pgboxes', array(
	   'settings' => 'ebooks_collection_disabled_pgboxes',
	   'section'   => 'ebooks_collection_features_section',
	   'label'     => __('Check To Enable This Section','ebooks-collection'),
	   'type'      => 'checkbox'
	));

	$wp_customize->add_setting('ebooks_collection_feature_heading',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_feature_heading', array(
	   'settings' => 'ebooks_collection_feature_heading',
	   'section'   => 'ebooks_collection_features_section',
	   'label' => __('Add Small Title', 'ebooks-collection'),
	   'type'      => 'text'
	));
	
	$wp_customize->add_setting('ebooks_collection_service_page',array(
		'default'	=> '0',
		'capability' => 'edit_theme_options',
		'sanitize_callback'	=> 'ebooks_collection_sanitize_dropdown_pages'
	));
	$wp_customize->add_control(	'ebooks_collection_service_page',array(
		'type' => 'dropdown-pages',
	   'label' => __('Select Service Page', 'ebooks-collection'),
		'section' => 'ebooks_collection_features_section',
	));	

	$wp_customize->add_setting( 'ebooks_collection_select_cat_services', array(
		'default'	=> '0',
		'sanitize_callback'	=> 'absint'
	) );
	$wp_customize->add_control( new Ebooks_Collection_Category_Dropdown_Custom_Control( $wp_customize, 'ebooks_collection_select_cat_services', array(
	    'type'    => 'select',
	    'label' => __('Select Category to display Latest Post','ebooks-collection'),
		'section' => 'ebooks_collection_features_section',
		'settings'   => 'ebooks_collection_select_cat_services',
	) ) );

	$wp_customize->add_setting( 'ebooks_collection_secondsec_settings_upgraded_features',array(
    'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_secondsec_settings_upgraded_features', array(
	    'type'=> 'hidden',
	    'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
	        <a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
	    'section' => 'ebooks_collection_features_section'
	));

	//Blog post
	$wp_customize->add_section('ebooks_collection_blog_post_settings',array(
        'title' => __('Manage Post Section', 'ebooks-collection'),
        'priority' => null,
        'panel' => 'ebooks_collection_panel_area'
    ) );

	// Layouts Post
	$wp_customize->add_setting(
		'ebooks_collection_blog_layout_option_setting',
		array(
			'default'           => 'Left',
			'sanitize_callback' => 'ebooks_collection_sanitize_choices',
		)
	);

	$wp_customize->add_control(
		new Ebooks_Collection_Image_Radio_Control(
			$wp_customize,
			'ebooks_collection_blog_layout_option_setting',
			array(
				'label'   => __( 'Post Layouts', 'ebooks-collection' ),
				'section' => 'ebooks_collection_blog_post_settings',
				'choices' => array(
					'Left' => get_template_directory_uri() . '/images/layout-1.png',
					'Center'    => get_template_directory_uri() . '/images/layout-2.png',
					'Right'   => get_template_directory_uri() . '/images/layout-3.png',
				),
			)
		)
	);

	$wp_customize->add_setting('ebooks_collection_metafields_date', array(
	    'default' => true,
	    'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control('ebooks_collection_metafields_date', array(
	    'settings' => 'ebooks_collection_metafields_date', 
	    'section'   => 'ebooks_collection_blog_post_settings',
	    'label'     => __('Check to Enable Date', 'ebooks-collection'),
	    'type'      => 'checkbox',
	));

	$wp_customize->add_setting('ebooks_collection_metafields_comments', array(
		'default' => true,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));	
	$wp_customize->add_control('ebooks_collection_metafields_comments', array(
		'settings' => 'ebooks_collection_metafields_comments',
		'section'  => 'ebooks_collection_blog_post_settings',
		'label'    => __('Check to Enable Comments', 'ebooks-collection'),
		'type'     => 'checkbox',
	));

	$wp_customize->add_setting('ebooks_collection_metafields_author', array(
		'default' => true,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control('ebooks_collection_metafields_author', array(
		'settings' => 'ebooks_collection_metafields_author',
		'section'  => 'ebooks_collection_blog_post_settings',
		'label'    => __('Check to Enable Author', 'ebooks-collection'),
		'type'     => 'checkbox',
	));		

	$wp_customize->add_setting('ebooks_collection_metafields_time', array(
		'default' => true,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control('ebooks_collection_metafields_time', array(
		'settings' => 'ebooks_collection_metafields_time',
		'section'  => 'ebooks_collection_blog_post_settings',
		'label'    => __('Check to Enable Time', 'ebooks-collection'),
		'type'     => 'checkbox',
	));	
	
	$wp_customize->add_setting('ebooks_collection_metabox_seperator',array(
		'default' => '|',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_metabox_seperator',array(
		'type' => 'text',
		'label' => __('Metabox Seperator','ebooks-collection'),
		'description' => __('Ex: "/", "|", "-", ...','ebooks-collection'),
		'section' => 'ebooks_collection_blog_post_settings'
	)); 

    // Add Settings and Controls for Post Layout
	$wp_customize->add_setting('ebooks_collection_sidebar_post_layout',array(
		'default' => 'right',
		'sanitize_callback' => 'ebooks_collection_sanitize_choices'
	));
	$wp_customize->add_control('ebooks_collection_sidebar_post_layout',array(
		'type' => 'radio',
		'label'     => __('Theme Post Sidebar Position', 'ebooks-collection'),
		'description'   => __('This option work for blog page, archive page and search page.', 'ebooks-collection'),
		'section' => 'ebooks_collection_blog_post_settings',
		'choices' => array(
			'left' => __('Left','ebooks-collection'),
			'right' => __('Right','ebooks-collection'),
			'three-column' => __('Three Columns','ebooks-collection'),
			'four-column' => __('Four Columns','ebooks-collection'),
			'grid' => __('Grid Layout','ebooks-collection'),
			'full' => __('No Sidebar','ebooks-collection')
     ),
	) );

	$wp_customize->add_setting('ebooks_collection_blog_post_description_option',array(
    	'default'   => 'Excerpt Content', 
        'sanitize_callback' => 'ebooks_collection_sanitize_choices'
	));
	$wp_customize->add_control('ebooks_collection_blog_post_description_option',array(
        'type' => 'radio',
        'label' => __('Post Description Length','ebooks-collection'),
        'section' => 'ebooks_collection_blog_post_settings',
        'choices' => array(
            'No Content' => __('No Content','ebooks-collection'),
            'Excerpt Content' => __('Excerpt Content','ebooks-collection'),
            'Full Content' => __('Full Content','ebooks-collection'),
        ),
	) );

	$wp_customize->add_setting('ebooks_collection_blog_post_thumb',array(
        'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
        'default'           => 1,
    ));
    $wp_customize->add_control('ebooks_collection_blog_post_thumb',array(
        'type'        => 'checkbox',
        'label'       => esc_html__('Show / Hide Blog Post Thumbnail', 'ebooks-collection'),
        'section'     => 'ebooks_collection_blog_post_settings',
    ));

	$wp_customize->add_setting( 'ebooks_collection_post_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_post_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		<a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_blog_post_settings'
	));	
	
	//Single Post Settings
	$wp_customize->add_section('ebooks_collection_single_post_settings',array(
		'title' => __('Manage Single Post Section', 'ebooks-collection'),
		'priority' => null,
		'panel' => 'ebooks_collection_panel_area'
	));

	$wp_customize->add_setting('ebooks_collection_single_post_date',array(
		'default' => true,
		'sanitize_callback'	=> 'ebooks_collection_sanitize_checkbox'
	));
	$wp_customize->add_control('ebooks_collection_single_post_date',array(
		'type' => 'checkbox',
		'label' => __('Enable / Disable Date ','ebooks-collection'),
		'section' => 'ebooks_collection_single_post_settings'
	));	

	$wp_customize->add_setting('ebooks_collection_single_post_author',array(
		'default' => true,
		'sanitize_callback'	=> 'ebooks_collection_sanitize_checkbox'
	));
	$wp_customize->add_control('ebooks_collection_single_post_author',array(
		'type' => 'checkbox',
		'label' => __('Enable / Disable Author','ebooks-collection'),
		'section' => 'ebooks_collection_single_post_settings'
	));

	$wp_customize->add_setting('ebooks_collection_single_post_comment',array(
		'default' => true,
		'sanitize_callback'	=> 'ebooks_collection_sanitize_checkbox'
	));
	$wp_customize->add_control('ebooks_collection_single_post_comment',array(
		'type' => 'checkbox',
		'label' => __('Enable / Disable Comments','ebooks-collection'),
		'section' => 'ebooks_collection_single_post_settings'
	));	

	$wp_customize->add_setting('ebooks_collection_single_post_time',array(
		'default' => true,
		'sanitize_callback'	=> 'ebooks_collection_sanitize_checkbox'
	));
	$wp_customize->add_control('ebooks_collection_single_post_time',array(
		'type' => 'checkbox',
		'label' => __('Enable / Disable Time','ebooks-collection'),
		'section' => 'ebooks_collection_single_post_settings'
	));	

	$wp_customize->add_setting('ebooks_collection_single_post_metabox_seperator',array(
		'default' => '|',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_single_post_metabox_seperator',array(
		'type' => 'text',
		'label' => __('Metabox Seperator','ebooks-collection'),
		'description' => __('Ex: "/", "|", "-", ...','ebooks-collection'),
		'section' => 'ebooks_collection_single_post_settings'
	)); 

	$wp_customize->add_setting('ebooks_collection_sidebar_single_post_layout',array(
    	'default' => 'right',
    	 'sanitize_callback' => 'ebooks_collection_sanitize_choices'
	));
	$wp_customize->add_control('ebooks_collection_sidebar_single_post_layout',array(
   		'type' => 'radio',
    	'label'     => __('Single post sidebar layout', 'ebooks-collection'),
     	'section' => 'ebooks_collection_single_post_settings',
     	'choices' => array(
			'left' => __('Left','ebooks-collection'),
			'right' => __('Right','ebooks-collection'),
			'full' => __('No Sidebar','ebooks-collection')
     ),
	));

	$wp_customize->add_setting( 'ebooks_collection_single_post_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_single_post_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		   <a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_single_post_settings'
	));

	//Page Settings
	$wp_customize->add_section('ebooks_collection_page_settings',array(
		'title' => __('Manage Page Section', 'ebooks-collection'),
		'priority' => null,
		'panel' => 'ebooks_collection_panel_area'
	));

	// Add Settings and Controls for Page Layout
	$wp_customize->add_setting('ebooks_collection_sidebar_page_layout',array(
		'default' => 'full',
			'sanitize_callback' => 'ebooks_collection_sanitize_choices'
	));
	$wp_customize->add_control('ebooks_collection_sidebar_page_layout',array(
		'type' => 'radio',
		'label'     => __('Theme Page Sidebar Position', 'ebooks-collection'),
		'section' => 'ebooks_collection_page_settings',
		'choices' => array(
			'left' => __('Left','ebooks-collection'),
			'right' => __('Right','ebooks-collection'),
			'full' => __('No Sidebar','ebooks-collection')
	),
	));	

	$wp_customize->add_setting( 'ebooks_collection_page_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_page_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		<a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_page_settings'
	));

	// 404 Page Settings
	$wp_customize->add_section('ebooks_collection_page_not_found', array(
		'title'	=> __('Manage 404 Page Section','ebooks-collection'),
		'priority'	=> null,
		'panel' => 'ebooks_collection_panel_area',
	));

	$wp_customize->add_setting('ebooks_collection_page_not_found_heading',array(
		'default'=> __('404 Not Found','ebooks-collection'),
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_page_not_found_heading',array(
		'label'	=> __('404 Heading','ebooks-collection'),
		'section'=> 'ebooks_collection_page_not_found',
		'type'=> 'text'
	));

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

	$wp_customize->add_control('ebooks_collection_page_not_found_content',array(
		'label'	=> __('404 Text','ebooks-collection'),
		'input_attrs' => array(
			'placeholder' => __( 'Looks like you have taken a wrong turn.....Don\'t worry... it happens to the best of us.', 'ebooks-collection' ),
		),
		'section'=> 'ebooks_collection_page_not_found',
		'type'=> 'text'
	));

	$wp_customize->add_setting('ebooks_collection_page_not_found_btn',array(
		'default' => 'Homepage',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_page_not_found_btn', array(
	   'settings' => 'ebooks_collection_page_not_found_btn',
	   'section'   => 'ebooks_collection_page_not_found',
	   'label' => __('404 Button', 'ebooks-collection'),
	   'type'      => 'text'
	));

	$wp_customize->add_setting( 'ebooks_collection_page_not_found_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_page_not_found_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
			<a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_page_not_found'
	));

	// Animation Section
	$wp_customize->add_section('ebooks_collection_animation', array(
		'title'	=> __('Manage Animation Section','ebooks-collection'),
		'description'	=> __('<p class="sec-title">Manage Animation Section</p>','ebooks-collection'),
		'priority'	=> null,
		'panel' => 'ebooks_collection_panel_area',
	));

	$wp_customize->add_setting('ebooks_collection_animation_enabled',array(
		'default' => true,
		'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_animation_enabled', array(
	   'settings' => 'ebooks_collection_animation_enabled',
	   'section'   => 'ebooks_collection_animation',
	   'label'     => __('Check To Enable Animation','ebooks-collection'),
	   'type'      => 'checkbox'
	));

	$wp_customize->add_setting( 'ebooks_collection_animation_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_animation_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		<a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_animation'
	));

	// Footer Section
	$wp_customize->add_section('ebooks_collection_footer', array(
		'title'	=> __('Manage Footer Section','ebooks-collection'),
		'description'	=> __('<p class="sec-title">Manage Footer Section</p>','ebooks-collection'),
		'priority'	=> null,
		'panel' => 'ebooks_collection_panel_area',
	));

	$wp_customize->add_setting('ebooks_collection_footer_widget', array(
	    'default' => true,
	    'sanitize_callback' => 'ebooks_collection_sanitize_checkbox',
	));
	$wp_customize->add_control('ebooks_collection_footer_widget', array(
	    'settings' => 'ebooks_collection_footer_widget', 
	    'section'   => 'ebooks_collection_footer',
	    'label'     => __('Check to Enable Footer Widget', 'ebooks-collection'),
	    'type'      => 'checkbox',
	));

	$wp_customize->add_setting('ebooks_collection_footer_bg_image',array(
        'default'   => '',
        'sanitize_callback' => 'esc_url_raw',
    ));
    $wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'ebooks_collection_footer_bg_image',array(
        'label' => __('Footer Background Image','ebooks-collection'),
        'section' => 'ebooks_collection_footer',
    )));

	$wp_customize->add_setting('ebooks_collection_footer_img_position',array(
		'default' => 'center center',
		'transport' => 'refresh',
		'sanitize_callback' => 'ebooks_collection_sanitize_choices'
	));
	$wp_customize->add_control('ebooks_collection_footer_img_position',array(
		'type' => 'select',
		'label' => __('Footer Image Position','ebooks-collection'),
		'section' => 'ebooks_collection_footer',
		'choices' 	=> array(
			'center center'   => esc_html__( 'Center', 'ebooks-collection' ),
			'center top'   => esc_html__( 'Top', 'ebooks-collection' ),
			'left center'   => esc_html__( 'Left', 'ebooks-collection' ),
			'right center'   => esc_html__( 'Right', 'ebooks-collection' ),
			'center bottom'   => esc_html__( 'Bottom', 'ebooks-collection' ),
		),
	));	

	$wp_customize->add_setting('ebooks_collection_copyright_line',array(
		'sanitize_callback' => 'sanitize_text_field',
	));
	$wp_customize->add_control( 'ebooks_collection_copyright_line', array(
	   'section' 	=> 'ebooks_collection_footer',
	   'label'	 	=> __('Copyright Line','ebooks-collection'),
	   'type'    	=> 'text',
	   'priority' 	=> null,
    ));

    $wp_customize->add_setting('ebooks_collection_copyright_link',array(
    	'default' => '',
		'sanitize_callback' => 'sanitize_text_field',
	));
	$wp_customize->add_control( 'ebooks_collection_copyright_link', array(
	   'section' 	=> 'ebooks_collection_footer',
	   'label'	 	=> __('Copyright Link','ebooks-collection'),
	   'type'    	=> 'text',
	   'priority' 	=> null,
    ));

	//  footer bg color
	$wp_customize->add_setting('ebooks_collection_footerbg_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footerbg_color', array(
		'settings' => 'ebooks_collection_footerbg_color',
		'section'   => 'ebooks_collection_footer',
		'label' => __('BG Color', 'ebooks-collection'),
		'type'      => 'color'
	));

	//  footer title color
	$wp_customize->add_setting('ebooks_collection_footertitle_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footertitle_color', array(
	   'settings' => 'ebooks_collection_footertitle_color',
	   'section'   => 'ebooks_collection_footer',
	   'label' => __('Title Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

	//  footer list color
	$wp_customize->add_setting('ebooks_collection_footerlist_color',array(
		'default' => '',
		'sanitize_callback' => 'ebooks_collection_sanitize_hex_color',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footerlist_color', array(
	   'settings' => 'ebooks_collection_footerlist_color',
	   'section'   => 'ebooks_collection_footer',
	   'label' => __('List Color', 'ebooks-collection'),
	   'type'      => 'color'
	));

	$wp_customize->add_setting('ebooks_collection_scroll_hide', array(
        'default' => true,
        'sanitize_callback' => 'ebooks_collection_sanitize_checkbox'
    ));
    $wp_customize->add_control( new WP_Customize_Control($wp_customize,'ebooks_collection_scroll_hide',array(
        'label'          => __( 'Check To Show Scroll To Top', 'ebooks-collection' ),
        'section'        => 'ebooks_collection_footer',
        'settings'       => 'ebooks_collection_scroll_hide',
        'type'           => 'checkbox',
    )));

    $wp_customize->add_setting('ebooks_collection_scroll_position',array(
        'default' => 'Right',
        'sanitize_callback' => 'ebooks_collection_sanitize_choices'
    ));
    $wp_customize->add_control('ebooks_collection_scroll_position',array(
        'type' => 'radio',
        'section' => 'ebooks_collection_footer',
        'label'	 	=> __('Scroll To Top Positions','ebooks-collection'),
        'choices' => array(
            'Right' => __('Right','ebooks-collection'),
            'Left' => __('Left','ebooks-collection'),
            'Center' => __('Center','ebooks-collection')
        ),
    ) );

	$wp_customize->add_setting('ebooks_collection_scroll_text',array(
		'default'	=> __('TOP','ebooks-collection'),
		'sanitize_callback'	=> 'sanitize_text_field',
	));	
	$wp_customize->add_control('ebooks_collection_scroll_text',array(
		'label'	=> __('Scroll To Top Button Text','ebooks-collection'),
		'section'	=> 'ebooks_collection_footer',
		'type'		=> 'text'
	));

	$wp_customize->add_setting( 'ebooks_collection_scroll_top_shape', array(
		'default'           => 'circle',
		'sanitize_callback' => 'sanitize_text_field',
	));
	$wp_customize->add_control( 'ebooks_collection_scroll_top_shape', array(
		'label'    => __( 'Scroll to Top Button Shape', 'ebooks-collection' ),
		'section'  => 'ebooks_collection_footer',
		'settings' => 'ebooks_collection_scroll_top_shape',
		'type'     => 'radio',
		'choices'  => array(
			'box'        => __( 'Box', 'ebooks-collection' ),
			'curved' => __( 'Curved', 'ebooks-collection'),
			'circle'     => __( 'Circle', 'ebooks-collection' ),
		),
	));

	$wp_customize->add_setting('ebooks_collection_footer_widget_areas',array(
		'default'           => 4,
		'sanitize_callback' => 'ebooks_collection_sanitize_choices',
	));
	$wp_customize->add_control('ebooks_collection_footer_widget_areas',array(
		'type'        => 'radio',
		'section' => 'ebooks_collection_footer',
		'label'       => __('Footer widget area', 'ebooks-collection'),
		'choices' => array(
		   '1'     => __('One', 'ebooks-collection'),
		   '2'     => __('Two', 'ebooks-collection'),
		   '3'     => __('Three', 'ebooks-collection'),
		   '4'     => __('Four', 'ebooks-collection')
		),
	));

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

	$wp_customize->add_control('ebooks_collection_footer_settings_upgraded_features', array(
	    'type'=> 'hidden',
	    'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
	        <a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
	    'section' => 'ebooks_collection_footer'
	));

	// Footer Social Section
	$wp_customize->add_section('ebooks_collection_footer_social_icons', array(
		'title'	=> __('Manage Footer Social Section','ebooks-collection'),
		'description'	=> __('<p class="sec-title">Manage Footer Social Section</p>','ebooks-collection'),
		'priority'	=> null,
		'panel' => 'ebooks_collection_panel_area',
	));

	$wp_customize->add_setting('ebooks_collection_footer_facebook_link',array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footer_facebook_link', array(
		'settings' => 'ebooks_collection_footer_facebook_link',
		'section'   => 'ebooks_collection_footer_social_icons',
		'label' => __('Facebook Link', 'ebooks-collection'),
		'type'      => 'url'
	));

	$wp_customize->add_setting('ebooks_collection_footer_instagram_link',array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footer_instagram_link', array(
		'settings' => 'ebooks_collection_footer_instagram_link',
		'section'   => 'ebooks_collection_footer_social_icons',
		'label' => __('Instagram Link', 'ebooks-collection'),
		'type'      => 'url'
	));

	$wp_customize->add_setting('ebooks_collection_footer_pinterest_link',array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footer_pinterest_link', array(
		'settings' => 'ebooks_collection_footer_pinterest_link',
		'section'   => 'ebooks_collection_footer_social_icons',
		'label' => __('Pinterest Link', 'ebooks-collection'),
		'type'      => 'url'
	));

	$wp_customize->add_setting('ebooks_collection_footer_twitter_link',array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footer_twitter_link', array(
		'settings' => 'ebooks_collection_footer_twitter_link',
		'section'   => 'ebooks_collection_footer_social_icons',
		'label' => __('Twitter Link', 'ebooks-collection'),
		'type'      => 'url'
	));
	
	$wp_customize->add_setting('ebooks_collection_footer_youtube_link',array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'ebooks_collection_footer_youtube_link', array(
		'settings' => 'ebooks_collection_footer_youtube_link',
		'section'   => 'ebooks_collection_footer_social_icons',
		'label' => __('Youtube Link', 'ebooks-collection'),
		'type'      => 'url'
	));

	$wp_customize->add_setting( 'ebooks_collection_footer_social_settings_upgraded_features',array(
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control('ebooks_collection_footer_social_settings_upgraded_features', array(
		'type'=> 'hidden',
		'description' => "<span class='customizer-upgraded-features'>Unlock Premium Customization Features:
		   <a target='_blank' href='". esc_url(EBOOKS_COLLECTION_PREMIUM_PAGE) ." '>Upgrade to Pro</a></span>",
		'section' => 'ebooks_collection_footer_social_icons'
	));

	// Google Fonts
	$wp_customize->add_section( 'ebooks_collection_google_fonts_section', array(
		'title'       => __( 'Google Fonts', 'ebooks-collection' ),
		'priority'    => 24,
	) );

	$font_choices = array(
		'' => 'No Fonts',
		'Kaushan Script:' => 'Kaushan Script',
		'Emilys Candy:' => 'Emilys Candy',
		'Poppins:0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900' => 'Poppins',
		'Source Sans Pro:400,700,400italic,700italic' => 'Source Sans Pro',
		'Open Sans:400italic,700italic,400,700' => 'Open Sans',
		'Oswald:400,700' => 'Oswald',
		'Playfair Display:400,700,400italic' => 'Playfair Display',
		'Montserrat:400,700' => 'Montserrat',
		'Raleway:400,700' => 'Raleway',
		'Droid Sans:400,700' => 'Droid Sans',
		'Lato:400,700,400italic,700italic' => 'Lato',
		'Arvo:400,700,400italic,700italic' => 'Arvo',
		'Lora:400,700,400italic,700italic' => 'Lora',
		'Merriweather:400,300italic,300,400italic,700,700italic' => 'Merriweather',
		'Oxygen:400,300,700' => 'Oxygen',
		'PT Serif:400,700' => 'PT Serif',
		'PT Sans:400,700,400italic,700italic' => 'PT Sans',
		'PT Sans Narrow:400,700' => 'PT Sans Narrow',
		'Cabin:400,700,400italic' => 'Cabin',
		'Fjalla One:400' => 'Fjalla One',
		'Francois One:400' => 'Francois One',
		'Josefin Sans:400,300,600,700' => 'Josefin Sans',
		'Libre Baskerville:400,400italic,700' => 'Libre Baskerville',
		'Arimo:400,700,400italic,700italic' => 'Arimo',
		'Ubuntu:400,700,400italic,700italic' => 'Ubuntu',
		'Bitter:400,700,400italic' => 'Bitter',
		'Droid Serif:400,700,400italic,700italic' => 'Droid Serif',
		'Roboto:400,400italic,700,700italic' => 'Roboto',
		'Open Sans Condensed:700,300italic,300' => 'Open Sans Condensed',
		'Roboto Condensed:400italic,700italic,400,700' => 'Roboto Condensed',
		'Roboto Slab:400,700' => 'Roboto Slab',
		'Yanone Kaffeesatz:400,700' => 'Yanone Kaffeesatz',
		'Rokkitt:400' => 'Rokkitt',
	);

	$wp_customize->add_setting( 'ebooks_collection_headings_fonts', array(
		'sanitize_callback' => 'ebooks_collection_sanitize_fonts',
	));
	$wp_customize->add_control( 'ebooks_collection_headings_fonts', array(
		'type' => 'select',
		'description' => __('Select your desired font for the headings.', 'ebooks-collection'),
		'section' => 'ebooks_collection_google_fonts_section',
		'choices' => $font_choices
	));

	$wp_customize->add_setting( 'ebooks_collection_body_fonts', array(
		'sanitize_callback' => 'ebooks_collection_sanitize_fonts'
	));
	$wp_customize->add_control( 'ebooks_collection_body_fonts', array(
		'type' => 'select',
		'description' => __( 'Select your desired font for the body.', 'ebooks-collection' ),
		'section' => 'ebooks_collection_google_fonts_section',
		'choices' => $font_choices
	));	

}
add_action( 'customize_register', 'ebooks_collection_customize_register' );

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function ebooks_collection_customize_preview_js() {
	wp_enqueue_script( 'ebooks_collection_customizer', esc_url(get_template_directory_uri()) . '/js/customize-preview.js', array( 'customize-preview' ), '20161510', true );
}
add_action( 'customize_preview_init', 'ebooks_collection_customize_preview_js' );
