<?php
/**
 * Food Blogger Hub: Customizer
 *
 * @package Food Blogger Hub
 * @subpackage food_blogger_hub
 */

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

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

        public function render_content() {
            echo '<span>Unlock Premium <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( FOOD_BLOGGER_HUB_BUY_TEXT,'food-blogger-hub' ) .'<strong></a>';
            echo '</a>';
        }
    }

    // Custom Controls
    function food_blogger_hub_sanitize_custom_control( $input ) {
        return $input;
    }

	require get_parent_theme_file_path('/inc/controls/icon-changer.php');

	require get_parent_theme_file_path('/inc/controls/range-slider-control.php');

	// Register the custom control type.
	$wp_customize->register_control_type( 'Food_Blogger_Hub_Toggle_Control' );

	//Register the sortable control type.
	$wp_customize->register_control_type( 'Food_Blogger_Hub_Control_Sortable' );	

	//add home page setting pannel
	$wp_customize->add_panel( 'food_blogger_hub_panel_id', array(
	    'priority' => 10,
	    'capability' => 'edit_theme_options',
	    'theme_supports' => '',
	    'title' => __( 'Custom Home page', 'food-blogger-hub' ),
	    'description' => __( 'Description of what this panel does.', 'food-blogger-hub' ),
	) );

	//TP Genral Option
	$wp_customize->add_section('food_blogger_hub_tp_general_settings',array(
        'title' => __('TP General Option', 'food-blogger-hub'),
        'priority' => 1,
        'panel' => 'food_blogger_hub_panel_id'
    ) );
 	$wp_customize->add_setting('food_blogger_hub_tp_body_layout_settings',array(
		'default' => 'Full',
		'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
	));

 	$wp_customize->add_control('food_blogger_hub_tp_body_layout_settings',array(
		'type' => 'radio',
		'label'     => __('Body Layout Setting', 'food-blogger-hub'),
		'description'   => __('This option work for complete body, if you want to set the complete website in container.', 'food-blogger-hub'),
		'section' => 'food_blogger_hub_tp_general_settings',
		'choices' => array(
		'Full' => __('Full','food-blogger-hub'),
		'Container' => __('Container','food-blogger-hub'),
		'Container Fluid' => __('Container Fluid','food-blogger-hub')
		),
	) );

    // Add Settings and Controls for Post Layout
	$wp_customize->add_setting('food_blogger_hub_sidebar_post_layout',array(
     'default' => 'right',
     'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
	));
	$wp_customize->add_control('food_blogger_hub_sidebar_post_layout',array(
     'type' => 'radio',
     'label'     => __('Post Sidebar Position', 'food-blogger-hub'),
     'description'   => __('This option work for blog page, blog single page, archive page and search page.', 'food-blogger-hub'),
     'section' => 'food_blogger_hub_tp_general_settings',
     'choices' => array(
         'full' => __('Full','food-blogger-hub'),
         'left' => __('Left','food-blogger-hub'),
         'right' => __('Right','food-blogger-hub'),
         'three-column' => __('Three Columns','food-blogger-hub'),
         'four-column' => __('Four Columns','food-blogger-hub'),
         'grid' => __('Grid Layout','food-blogger-hub')
     ),
	) );

	// Add Settings and Controls for single post sidebar Layout
	$wp_customize->add_setting('food_blogger_hub_sidebar_single_post_layout',array(
        'default' => 'right',
        'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
	));
	$wp_customize->add_control('food_blogger_hub_sidebar_single_post_layout',array(
        'type' => 'radio',
        'label'     => __('Single Post Sidebar Position', 'food-blogger-hub'),
        'description'   => __('This option work for single blog page', 'food-blogger-hub'),
        'section' => 'food_blogger_hub_tp_general_settings',
        'choices' => array(
            'full' => __('Full','food-blogger-hub'),
            'left' => __('Left','food-blogger-hub'),
            'right' => __('Right','food-blogger-hub'),
        ),
	) );

	// Add Settings and Controls for Page Layout
	$wp_customize->add_setting('food_blogger_hub_sidebar_page_layout',array(
     'default' => 'right',
     'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
	));
	$wp_customize->add_control('food_blogger_hub_sidebar_page_layout',array(
     'type' => 'radio',
     'label'     => __('Page Sidebar Position', 'food-blogger-hub'),
     'description'   => __('This option work for pages.', 'food-blogger-hub'),
     'section' => 'food_blogger_hub_tp_general_settings',
     'choices' => array(
         'full' => __('Full','food-blogger-hub'),
         'left' => __('Left','food-blogger-hub'),
         'right' => __('Right','food-blogger-hub')
     ),
	) );
	//tp typography option
	$food_blogger_hub_font_array = array(
		''                       => 'No Fonts',
		'Abril Fatface'          => 'Abril Fatface',
		'Acme'                   => 'Acme',
		'Anton'                  => 'Anton',
		'Architects Daughter'    => 'Architects Daughter',
		'Arimo'                  => 'Arimo',
		'Arsenal'                => 'Arsenal',
		'Arvo'                   => 'Arvo',
		'Alegreya'               => 'Alegreya',
		'Alfa Slab One'          => 'Alfa Slab One',
		'Averia Serif Libre'     => 'Averia Serif Libre',
		'Bangers'                => 'Bangers',
		'Boogaloo'               => 'Boogaloo',
		'Bad Script'             => 'Bad Script',
		'Bitter'                 => 'Bitter',
		'Bree Serif'             => 'Bree Serif',
		'BenchNine'              => 'BenchNine',
		'Cabin'                  => 'Cabin',
		'Cardo'                  => 'Cardo',
		'Courgette'              => 'Courgette',
		'Cherry Swash'           => 'Cherry Swash',
		'Cormorant Garamond'     => 'Cormorant Garamond',
		'Crimson Text'           => 'Crimson Text',
		'Cuprum'                 => 'Cuprum',
		'Cookie'                 => 'Cookie',
		'Chewy'                  => 'Chewy',
		'Days One'               => 'Days One',
		'Dosis'                  => 'Dosis',
		'Droid Sans'             => 'Droid Sans',
		'Economica'              => 'Economica',
		'Fredoka One'            => 'Fredoka One',
		'Fjalla One'             => 'Fjalla One',
		'Francois One'           => 'Francois One',
		'Frank Ruhl Libre'       => 'Frank Ruhl Libre',
		'Gloria Hallelujah'      => 'Gloria Hallelujah',
		'Great Vibes'            => 'Great Vibes',
		'Handlee'                => 'Handlee',
		'Hammersmith One'        => 'Hammersmith One',
		'Inconsolata'            => 'Inconsolata',
		'Indie Flower'           => 'Indie Flower',
		'IM Fell English SC'     => 'IM Fell English SC',
		'Julius Sans One'        => 'Julius Sans One',
		'Josefin Slab'           => 'Josefin Slab',
		'Josefin Sans'           => 'Josefin Sans',
		'Kanit'                  => 'Kanit',
		'Lobster'                => 'Lobster',
		'Lato'                   => 'Lato',
		'Lora'                   => 'Lora',
		'Libre Baskerville'      => 'Libre Baskerville',
		'Lobster Two'            => 'Lobster Two',
		'Merriweather'           => 'Merriweather',
		'Monda'                  => 'Monda',
		'Montserrat'             => 'Montserrat',
		'Muli'                   => 'Muli',
		'Marck Script'           => 'Marck Script',
		'Noto Serif'             => 'Noto Serif',
		'Open Sans'              => 'Open Sans',
		'Overpass'               => 'Overpass',
		'Overpass Mono'          => 'Overpass Mono',
		'Oxygen'                 => 'Oxygen',
		'Orbitron'               => 'Orbitron',
		'Patua One'              => 'Patua One',
		'Pacifico'               => 'Pacifico',
		'Padauk'                 => 'Padauk',
		'Playball'               => 'Playball',
		'Playfair Display'       => 'Playfair Display',
		'PT Sans'                => 'PT Sans',
		'Philosopher'            => 'Philosopher',
		'Permanent Marker'       => 'Permanent Marker',
		'Poiret One'             => 'Poiret One',
		'Quicksand'              => 'Quicksand',
		'Quattrocento Sans'      => 'Quattrocento Sans',
		'Raleway'                => 'Raleway',
		'Rubik'                  => 'Rubik',
		'Rokkitt'                => 'Rokkitt',
		'Russo One'              => 'Russo One',
		'Righteous'              => 'Righteous',
		'Slabo'                  => 'Slabo',
		'Source Sans Pro'        => 'Source Sans Pro',
		'Shadows Into Light Two' => 'Shadows Into Light Two',
		'Shadows Into Light'     => 'Shadows Into Light',
		'Sacramento'             => 'Sacramento',
		'Shrikhand'              => 'Shrikhand',
		'Tangerine'              => 'Tangerine',
		'Ubuntu'                 => 'Ubuntu',
		'VT323'                  => 'VT323',
		'Varela Round'           => 'Varela Round',
		'Vampiro One'            => 'Vampiro One',
		'Vollkorn'               => 'Vollkorn',
		'Volkhov'                => 'Volkhov',
		'Yanone Kaffeesatz'      => 'Yanone Kaffeesatz'
	);

	$wp_customize->add_section('food_blogger_hub_typography_option',array(
		'title'         => __('TP Typography Option', 'food-blogger-hub'),
		'priority' => 1,
		'panel' => 'food_blogger_hub_panel_id'
   	));

   	$wp_customize->add_setting('food_blogger_hub_heading_font_family', array(
		'default'           => '',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'food_blogger_hub_sanitize_choices',
	));
	$wp_customize->add_control(	'food_blogger_hub_heading_font_family', array(
		'section' => 'food_blogger_hub_typography_option',
		'label'   => __('heading Fonts', 'food-blogger-hub'),
		'type'    => 'select',
		'choices' => $food_blogger_hub_font_array,
	));

	$wp_customize->add_setting('food_blogger_hub_body_font_family', array(
		'default'           => '',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'food_blogger_hub_sanitize_choices',
	));
	$wp_customize->add_control(	'food_blogger_hub_body_font_family', array(
		'section' => 'food_blogger_hub_typography_option',
		'label'   => __('Body Fonts', 'food-blogger-hub'),
		'type'    => 'select',
		'choices' => $food_blogger_hub_font_array,
	));

	//TP Color Option
	$wp_customize->add_section('food_blogger_hub_color_option',array(
     'title'         => __('TP Color Option', 'food-blogger-hub'),
     'priority' => 1,
     'panel' => 'food_blogger_hub_panel_id'
    ) );
    
	$wp_customize->add_setting( 'food_blogger_hub_tp_color_option', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_tp_color_option', array(
			'label'     => __('Theme First Color', 'food-blogger-hub'),
	    'description' => __('It will change the complete theme color in one click.', 'food-blogger-hub'),
	    'section' => 'food_blogger_hub_color_option',
	    'settings' => 'food_blogger_hub_tp_color_option',
  	)));

	//TP Preloader Option
	$wp_customize->add_section('food_blogger_hub_prelaoder_option',array(
		'title'         => __('TP Preloader Option', 'food-blogger-hub'),
		'priority' => 1,
		'panel' => 'food_blogger_hub_panel_id'
	) );
	$wp_customize->add_setting( 'food_blogger_hub_preloader_show_hide', array(
		'default'           => false,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_preloader_show_hide', array(
		'label'       => esc_html__( 'Show / Hide Preloader Option', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_prelaoder_option',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_preloader_show_hide',
	) ) );
	$wp_customize->add_setting( 'food_blogger_hub_tp_preloader_color1_option', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_tp_preloader_color1_option', array(
			'label'     => __('Preloader First Ring Color', 'food-blogger-hub'),
	    'description' => __('It will change the complete theme preloader ring 1 color in one click.', 'food-blogger-hub'),
	    'section' => 'food_blogger_hub_prelaoder_option',
	    'settings' => 'food_blogger_hub_tp_preloader_color1_option',
  	)));
  	$wp_customize->add_setting( 'food_blogger_hub_tp_preloader_color2_option', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_tp_preloader_color2_option', array(
			'label'     => __('Preloader Second Ring Color', 'food-blogger-hub'),
	    'description' => __('It will change the complete theme preloader ring 2 color in one click.', 'food-blogger-hub'),
	    'section' => 'food_blogger_hub_prelaoder_option',
	    'settings' => 'food_blogger_hub_tp_preloader_color2_option',
  	)));
  	$wp_customize->add_setting( 'food_blogger_hub_tp_preloader_bg_color_option', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_tp_preloader_bg_color_option', array(
			'label'     => __('Preloader Background Color', 'food-blogger-hub'),
	    'description' => __('It will change the complete theme preloader bg color in one click.', 'food-blogger-hub'),
	    'section' => 'food_blogger_hub_prelaoder_option',
	    'settings' => 'food_blogger_hub_tp_preloader_bg_color_option',
  	)));

  	// Pro Version
    $wp_customize->add_setting( 'food_blogger_hub_preloader_pro_version_logo', array(
        'sanitize_callback' => 'food_blogger_hub_sanitize_custom_control'
    ));
    $wp_customize->add_control( new food_blogger_hub_Customize_Pro_Version ( $wp_customize,'food_blogger_hub_preloader_pro_version_logo', array(
        'section'     => 'food_blogger_hub_prelaoder_option',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Features ', 'food-blogger-hub' ),
        'description' => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL ),
        'priority'    => 100
    )));

	//TP Blog Option
	$wp_customize->add_section('food_blogger_hub_blog_option',array(
		'title' => __('TP Blog Option', 'food-blogger-hub'),
		'priority' => 1,
		'panel' => 'food_blogger_hub_panel_id'
	) );

	$wp_customize->add_setting('food_blogger_hub_edit_blog_page_title',array(
		'default'=> __('Home','food-blogger-hub'),
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('food_blogger_hub_edit_blog_page_title',array(
		'label'	=> __('Change Blog Page Title','food-blogger-hub'),
		'section'=> 'food_blogger_hub_blog_option',
		'type'=> 'text'
	));

	$wp_customize->add_setting('food_blogger_hub_edit_blog_page_description',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('food_blogger_hub_edit_blog_page_description',array(
		'label'	=> __('Add Blog Page Description','food-blogger-hub'),
		'section'=> 'food_blogger_hub_blog_option',
		'type'=> 'text'
	));

	$wp_customize->add_setting('blog_meta_order', array(
        'default' => array('date', 'author', 'comment', 'category', 'time'),
        'sanitize_callback' => 'food_blogger_hub_sanitize_sortable',
    ));
    $wp_customize->add_control(new Food_Blogger_Hub_Control_Sortable($wp_customize, 'blog_meta_order', array(
    	'label' => esc_html__('Meta Order', 'food-blogger-hub'),
        'description' => __('Drag & Drop post items to re-arrange the order and also hide and show items as per the need by clicking on the eye icon.', 'food-blogger-hub') ,
        'section' => 'food_blogger_hub_blog_option',
        'choices' => array(
            'date' => __('date', 'food-blogger-hub') ,
            'author' => __('author', 'food-blogger-hub') ,
            'comment' => __('comment', 'food-blogger-hub') ,
            'category' => __('category', 'food-blogger-hub') ,
            'time' => __('time', 'food-blogger-hub') ,
        ) ,
    )));

    $wp_customize->add_setting( 'food_blogger_hub_excerpt_count', array(
		'default'              => 35,
		'type'                 => 'theme_mod',
		'transport' 		   => 'refresh',
		'sanitize_callback'    => 'food_blogger_hub_sanitize_number_range',
		'sanitize_js_callback' => 'absint',
	) );
	$wp_customize->add_control( 'food_blogger_hub_excerpt_count', array(
		'label'       => esc_html__( 'Edit Excerpt Limit','food-blogger-hub' ),
		'section'     => 'food_blogger_hub_blog_option',
		'type'        => 'number',
		'input_attrs' => array(
			'step'             => 2,
			'min'              => 0,
			'max'              => 50,
		),
	) );

	$wp_customize->add_setting('food_blogger_hub_read_more_text',array(
		'default'=> __('Read More','food-blogger-hub'),
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('food_blogger_hub_read_more_text',array(
		'label'	=> __('Edit Button Text','food-blogger-hub'),
		'section'=> 'food_blogger_hub_blog_option',
		'type'=> 'text'
	));

	 $wp_customize->add_setting('food_blogger_hub_post_image_round', array(
	  'default' => '0',
      'sanitize_callback' => 'food_blogger_hub_sanitize_number_range',
	));
	$wp_customize->add_control(new food_blogger_hub_Range_Slider($wp_customize, 'food_blogger_hub_post_image_round', array(
       'section' => 'food_blogger_hub_blog_option',
      'label' => esc_html__('Edit Post Image Border Radius', 'food-blogger-hub'),
      'input_attrs' => array(
        'min' => 0,
        'max' => 180,
        'step' => 1
    )
	)));

	$wp_customize->add_setting('food_blogger_hub_post_image_width', array(
	  'default' => '',
      'sanitize_callback' => 'food_blogger_hub_sanitize_number_range',
	));
	$wp_customize->add_control(new food_blogger_hub_Range_Slider($wp_customize, 'food_blogger_hub_post_image_width', array(
       'section' => 'food_blogger_hub_blog_option',
      'label' => esc_html__('Edit Post Image Width', 'food-blogger-hub'),
      'input_attrs' => array(
        'min' => 0,
        'max' => 367,
        'step' => 1
    )
	)));

	$wp_customize->add_setting('food_blogger_hub_post_image_length', array(
	  'default' => '',
      'sanitize_callback' => 'food_blogger_hub_sanitize_number_range',
	));
	$wp_customize->add_control(new food_blogger_hub_Range_Slider($wp_customize, 'food_blogger_hub_post_image_length', array(
       'section' => 'food_blogger_hub_blog_option',
      'label' => esc_html__('Edit Post Image height', 'food-blogger-hub'),
      'input_attrs' => array(
        'min' => 0,
        'max' => 900,
        'step' => 1
    )
	)));

	$wp_customize->add_setting( 'food_blogger_hub_remove_read_button', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_remove_read_button', array(
		'label'       => esc_html__( 'Show / Hide Read More Button', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_blog_option',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_remove_read_button',
	) ) );

    $wp_customize->selective_refresh->add_partial( 'food_blogger_hub_remove_read_button', array(
		'selector' => '.readmore-btn',
		'render_callback' => 'Food_Blogger_Hub_Customize_partial_food_blogger_hub_remove_read_button',
	 ));

	 $wp_customize->add_setting( 'food_blogger_hub_remove_tags', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_remove_tags', array(
		'label'       => esc_html__( 'Show / Hide Tags Option', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_blog_option',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_remove_tags',
	) ) );
    $wp_customize->selective_refresh->add_partial( 'food_blogger_hub_remove_tags', array(
		'selector' => '.box-content a[rel="tag"]',
		'render_callback' => 'Food_Blogger_Hub_Customize_partial_food_blogger_hub_remove_tags',
	));
	$wp_customize->add_setting( 'food_blogger_hub_remove_category', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_remove_category', array(
		'label'       => esc_html__( 'Show / Hide Category Option', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_blog_option',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_remove_category',
	) ) );
    $wp_customize->selective_refresh->add_partial( 'food_blogger_hub_remove_category', array(
		'selector' => '.box-content a[rel="category"]',
		'render_callback' => 'Food_Blogger_Hub_Customize_partial_food_blogger_hub_remove_category',
	));
	$wp_customize->add_setting( 'food_blogger_hub_remove_comment', array(
	 'default'           => true,
	 'transport'         => 'refresh',
	 'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
 	) );

	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_remove_comment', array(
	 'label'       => esc_html__( 'Show / Hide Comment Form', 'food-blogger-hub' ),
	 'section'     => 'food_blogger_hub_blog_option',
	 'type'        => 'toggle',
	 'settings'    => 'food_blogger_hub_remove_comment',
	) ) );

	$wp_customize->add_setting( 'food_blogger_hub_remove_related_post', array(
	 'default'           => true,
	 'transport'         => 'refresh',
	 'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
 	) );

	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_remove_related_post', array(
	 'label'       => esc_html__( 'Show / Hide Related Post', 'food-blogger-hub' ),
	 'section'     => 'food_blogger_hub_blog_option',
	 'type'        => 'toggle',
	 'settings'    => 'food_blogger_hub_remove_related_post',
	) ) );
	$wp_customize->add_setting( 'food_blogger_hub_related_post_per_page', array(
		'default'              => 3,
		'type'                 => 'theme_mod',
		'transport' 		   => 'refresh',
		'sanitize_callback'    => 'food_blogger_hub_sanitize_number_range',
		'sanitize_js_callback' => 'absint',
	) );
	$wp_customize->add_control( 'food_blogger_hub_related_post_per_page', array(
		'label'       => esc_html__( 'Related Post Per Page','food-blogger-hub' ),
		'section'     => 'food_blogger_hub_blog_option',
		'type'        => 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 3,
			'max'              => 9,
		),
	) );

 	 //MENU TYPOGRAPHY
	$wp_customize->add_section( 'food_blogger_hub_menu_typography', array(
    	'title'      => __( 'Menu Typography', 'food-blogger-hub' ),
    	'priority' => 2,
		'panel' => 'food_blogger_hub_panel_id'
	) );

	$wp_customize->add_setting('food_blogger_hub_menu_font_family', array(
		'default'           => '',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'food_blogger_hub_sanitize_choices',
	));
	$wp_customize->add_control(	'food_blogger_hub_menu_font_family', array(
		'section' => 'food_blogger_hub_menu_typography',
		'label'   => __('Menu Fonts', 'food-blogger-hub'),
		'type'    => 'select',
		'choices' => $food_blogger_hub_font_array,
	));

	$wp_customize->add_setting('food_blogger_hub_menu_text_tranform',array(
		'default' => '',
		'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
 	));
 	$wp_customize->add_control('food_blogger_hub_menu_text_tranform',array(
		'type' => 'select',
		'label' => __('Menu Text Transform','food-blogger-hub'),
		'section' => 'food_blogger_hub_menu_typography',
		'choices' => array(
		   'Uppercase' => __('Uppercase','food-blogger-hub'),
		   'Lowercase' => __('Lowercase','food-blogger-hub'),
		   'Capitalize' => __('Capitalize','food-blogger-hub'),
		),
	) );
	
	$wp_customize->add_setting('food_blogger_hub_menu_font_size', array(
	  'default' => '',
      'sanitize_callback' => 'food_blogger_hub_sanitize_number_range',
	));
	$wp_customize->add_control(new Food_Blogger_Hub_Range_Slider($wp_customize, 'food_blogger_hub_menu_font_size', array(
       'section' => 'food_blogger_hub_menu_typography',
      'label' => esc_html__('Font Size', 'food-blogger-hub'),
      'input_attrs' => array(
        'min' => 0,
        'max' => 20,
        'step' => 1
    )
	)));

	$wp_customize->add_setting( 'food_blogger_hub_menu_color', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_menu_color', array(
			'label'     => __('Change Menu Color', 'food-blogger-hub'),
	    'section' => 'food_blogger_hub_menu_typography',
	    'settings' => 'food_blogger_hub_menu_color',
  	)));

  	// Pro Version
    $wp_customize->add_setting( 'food_blogger_hub_menu_pro_version_logo', array(
        'sanitize_callback' => 'food_blogger_hub_sanitize_custom_control'
    ));
    $wp_customize->add_control( new food_blogger_hub_Customize_Pro_Version ( $wp_customize,'food_blogger_hub_menu_pro_version_logo', array(
        'section'     => 'food_blogger_hub_menu_typography',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Features ', 'food-blogger-hub' ),
        'description' => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL ),
        'priority'    => 100
    )));

	//Slider
  	$wp_customize->add_section('food_blogger_hub_slider_section',array(
	    'title' => __('Slider Section','food-blogger-hub'),
	    'priority'  => 6,
	    'panel' => 'food_blogger_hub_panel_id',
	));

	$wp_customize->add_setting('food_blogger_hub_slider',array(
		'default' => true,
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
		'capability' => 'edit_theme_options',
	));
	$wp_customize->add_control( 'food_blogger_hub_slider', array(
	   'settings' => 'food_blogger_hub_slider',
	   'section'   => 'food_blogger_hub_slider_section',
	   'label'     => __('Check To Enable This Section','food-blogger-hub'),
	   'type'      => 'checkbox'
	));

	$wp_customize->add_setting( 'food_blogger_hub_show_slider_title', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new food_blogger_hub_Toggle_Control( $wp_customize, 'food_blogger_hub_show_slider_title', array(
		'label'       => esc_html__( 'Show / Hide Slider Heading', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_slider_section',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_show_slider_title',
	) ) );

	$wp_customize->add_setting( 'food_blogger_hub_show_slider_content', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new food_blogger_hub_Toggle_Control( $wp_customize, 'food_blogger_hub_show_slider_content', array(
		'label'       => esc_html__( 'Show / Hide Slider Content', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_slider_section',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_show_slider_content',
	) ) );

	$categories = get_categories();
	$cat_post = array();
	$i = 0;
	$cat_post['select'] = 'Select'; // Adding a default 'Select' option

	foreach ($categories as $category) {
	    if ($i == 0) {
	        $default = $category->slug; // Set the first category slug as default
	        $i++;
	    }
	    $cat_post[$category->slug] = $category->name; // Store category slug and name in the array
	}

	// Add Customizer setting for selecting category
$wp_customize->add_setting('food_blogger_hub_slider_catData', array(
    'default' => '', // Set default value to the first category slug
    'sanitize_callback' => 'food_blogger_hub_sanitize_choices', // Sanitization function
));

$wp_customize->add_control('food_blogger_hub_slider_catData', array(
    'type'    => 'select',
    'choices' => $cat_post,
    'label' => __('Select Slider Category', 'food-blogger-hub'),
    'description' => __('Choose the category to display in the slider. Up to 5 posts from the selected category will be shown.', 'food-blogger-hub'),
    'section' => 'food_blogger_hub_slider_section', // Assign to a customizer section
));

	$wp_customize->add_setting('food_blogger_hub_customer_img',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw',
	));
	$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'food_blogger_hub_customer_img',array(
	    'label' => __('Add Reviewer Photo','food-blogger-hub'),
	     'section' => 'food_blogger_hub_slider_section'
	)));

	// name
	$wp_customize->add_setting(
	    'food_blogger_hub_reviewer_name',
	    array(
	        'default'           => '',
	        'sanitize_callback' => 'sanitize_text_field',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_reviewer_name',
	    array(
	        'type'    => 'text',
	        'label'   => __('Add Reviewer Name', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_slider_section',
	    )
	);

	$wp_customize->add_setting(
	    'food_blogger_hub_total_rating',
	    array(
	        'default'           => '',
	        'sanitize_callback' => 'sanitize_text_field',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_total_rating',
	    array(
	        'type'    => 'text',
	        'label'   => __('Add Rating', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_slider_section',
	    )
	);

	// Pro Version
    $wp_customize->add_setting( 'food_blogger_hub_slider_pro_version_logo', array(
        'sanitize_callback' => 'food_blogger_hub_sanitize_custom_control'
    ));
    $wp_customize->add_control( new food_blogger_hub_Customize_Pro_Version ( $wp_customize,'food_blogger_hub_slider_pro_version_logo', array(
        'section'     => 'food_blogger_hub_slider_section',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Features ', 'food-blogger-hub' ),
        'description' => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL ),
        'priority'    => 100
    )));
	
	// Add Latest Posts Section
	$wp_customize->add_section(
	    'food_blogger_hub_latests_posts',
	    array(
	        'title'    => esc_html__('Latest Posts Section', 'food-blogger-hub'),
	        'priority' => 7,
	        'panel'    => 'food_blogger_hub_panel_id',
	    )
	);

	// Hide/Show Setting
	$wp_customize->add_setting(
	    'food_blogger_hub_latest_posts_sec',
	    array(
	        'default'           => '1',
	        'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	        'capability'        => 'edit_theme_options',
	        'priority'          => 1,
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_latest_posts_sec',
	    array(
	        'label'    => esc_html__('Hide / Show Section', 'food-blogger-hub'),
	        'section'  => 'food_blogger_hub_latests_posts',
	        'settings' => 'food_blogger_hub_latest_posts_sec',
	        'type'     => 'checkbox',
	    )
	);

	// Section Title
	$wp_customize->add_setting(
	    'food_blogger_hub_section_title',
	    array(
	        'default'           => '',
	        'sanitize_callback' => 'sanitize_text_field',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_section_title',
	    array(
	        'label'    => __('Add Title', 'food-blogger-hub'),
	        'section'  => 'food_blogger_hub_latests_posts',
	        'type'     => 'text',
	    )
	);

	// Small Title
	$wp_customize->add_setting(
	    'food_blogger_hub_small_title',
	    array(
	        'default'           => '',
	        'sanitize_callback' => 'sanitize_text_field',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_small_title',
	    array(
	        'type'    => 'text',
	        'label'   => __('Add Content', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_latests_posts',
	    )
	);

	// Post Selector
	$wp_customize->add_setting(
	    'food_blogger_hub_post_first',
	    array(
	        'sanitize_callback' => 'absint',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_post_first',
	    array(
	        'type'    => 'select',
	        'choices' => array_reduce(get_posts(array('numberposts' => -1)), function($choices, $post) {
	            $choices[$post->ID] = $post->post_title;
	            return $choices;
	        }, array('page-none-selected' => __('Select', 'food-blogger-hub'))),
	        'label'   => __('Select Post 1', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_latests_posts',
	    )
	);

	// Post Selector
	$wp_customize->add_setting(
	    'food_blogger_hub_post_second',
	    array(
	        'sanitize_callback' => 'absint',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_post_second',
	    array(
	        'type'    => 'select',
	        'choices' => array_reduce(get_posts(array('numberposts' => -1)), function($choices, $post) {
	            $choices[$post->ID] = $post->post_title;
	            return $choices;
	        }, array('page-none-selected' => __('Select', 'food-blogger-hub'))),
	        'label'   => __('Select Post 2', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_latests_posts',
	    )
	);

	// YouTube URL
	$wp_customize->add_setting(
	    'food_blogger_hub_youtube_url',
	    array(
	        'default'           => '',
	        'sanitize_callback' => 'esc_url_raw',
	    )
	);

	$wp_customize->add_control(
	    'food_blogger_hub_youtube_url',
	    array(
	        'type'    => 'url',
	        'label'   => __('YouTube URL', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_latests_posts',
	    )
	);

	$wp_customize->add_setting(
	    'food_blogger_hub_post_third',
	    array(
	        'sanitize_callback' => 'absint',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_post_third',
	    array(
	        'type'    => 'select',
	        'choices' => array_reduce(get_posts(array('numberposts' => -1)), function($choices, $post) {
	            $choices[$post->ID] = $post->post_title;
	            return $choices;
	        }, array('page-none-selected' => __('Select', 'food-blogger-hub'))),
	        'label'   => __('Select Post 3', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_latests_posts',
	    )
	);

	$wp_customize->add_setting(
	    'food_blogger_hub_post_fourth',
	    array(
	        'sanitize_callback' => 'absint',
	    )
	);
	$wp_customize->add_control(
	    'food_blogger_hub_post_fourth',
	    array(
	        'type'    => 'select',
	        'choices' => array_reduce(get_posts(array('numberposts' => -1)), function($choices, $post) {
	            $choices[$post->ID] = $post->post_title;
	            return $choices;
	        }, array('page-none-selected' => __('Select', 'food-blogger-hub'))),
	        'label'   => __('Select Post 4', 'food-blogger-hub'),
	        'section' => 'food_blogger_hub_latests_posts',
	    )
	);

	// Pro Version
    $wp_customize->add_setting( 'food_blogger_hub_about_pro_version_logo', array(
        'sanitize_callback' => 'food_blogger_hub_sanitize_custom_control'
    ));
    $wp_customize->add_control( new food_blogger_hub_Customize_Pro_Version ( $wp_customize,'food_blogger_hub_about_pro_version_logo', array(
        'section'     => 'food_blogger_hub_latests_posts',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Features ', 'food-blogger-hub' ),
        'description' => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL ),
        'priority'    => 100
    )));

	//footer
	$wp_customize->add_section('food_blogger_hub_footer_section',array(
		'title'	=> __('Footer Widget Settings','food-blogger-hub'),
		'panel' => 'food_blogger_hub_panel_id',
		'priority' => 7,
	));

	// footer columns
	$wp_customize->add_setting('food_blogger_hub_footer_columns',array(
		'default'	=> 4,
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_footer_columns',array(
		'label'	=> __('Footer Widget Columns','food-blogger-hub'),
		'section'	=> 'food_blogger_hub_footer_section',
		'setting'	=> 'food_blogger_hub_footer_columns',
		'type'	=> 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 1,
			'max'              => 4,
		),
	));
	$wp_customize->add_setting( 'food_blogger_hub_tp_footer_bg_color_option', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_tp_footer_bg_color_option', array(
			'label'     => __('Footer Widget Background Color', 'food-blogger-hub'),
			'description' => __('It will change the complete footer widget backgorund color.', 'food-blogger-hub'),
			'section' => 'food_blogger_hub_footer_section',
			'settings' => 'food_blogger_hub_tp_footer_bg_color_option',
	)));
	$wp_customize->add_setting('food_blogger_hub_footer_widget_image',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw',
	));
	$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'food_blogger_hub_footer_widget_image',array(
        'label' => __('Footer Widget Background Image','food-blogger-hub'),
         'section' => 'food_blogger_hub_footer_section'
	)));

	//footer widget title font size
	$wp_customize->add_setting('food_blogger_hub_footer_widget_title_font_size',array(
		'default'	=> '',
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_footer_widget_title_font_size',array(
		'label'	=> __('Change Footer Widget Title Font Size in PX','food-blogger-hub'),
		'section'	=> 'food_blogger_hub_footer_section',
	    'setting'	=> 'food_blogger_hub_footer_widget_title_font_size',
		'type'	=> 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 0,
			'max'              => 50,
		),
	));

	$wp_customize->add_setting( 'food_blogger_hub_footer_widget_title_color', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_footer_widget_title_color', array(
			'label'     => __('Change Footer Widget Title Color', 'food-blogger-hub'),
	    'section' => 'food_blogger_hub_footer_section',
	    'settings' => 'food_blogger_hub_footer_widget_title_color',
  	)));
  	
	$wp_customize->add_setting( 'food_blogger_hub_return_to_header', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_return_to_header', array(
		'label'       => esc_html__( 'Show / Hide Return to header', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_footer_section',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_return_to_header',
	) ) );
    $wp_customize->add_setting('food_blogger_hub_scroll_top_icon',array(
	  'default'	=> 'fas fa-arrow-up',
	  'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control(new Food_Blogger_Hub_Icon_Changer(
	        $wp_customize,'food_blogger_hub_scroll_top_icon',array(
		'label'	=> __('Scroll to top Icon','food-blogger-hub'),
		'transport' => 'refresh',
		'section'	=> 'food_blogger_hub_footer_section',
			'type'		=> 'icon'
	)));

    // Add Settings and Controls for Scroll top
	$wp_customize->add_setting('food_blogger_hub_scroll_top_position',array(
        'default' => 'Right',
        'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
	));
	$wp_customize->add_control('food_blogger_hub_scroll_top_position',array(
        'type' => 'radio',
        'label'     => __('Scroll to top Position', 'food-blogger-hub'),
        'description'   => __('This option work for scroll to top', 'food-blogger-hub'),
       'section' => 'food_blogger_hub_footer_section',
       'choices' => array(
            'Right' => __('Right','food-blogger-hub'),
            'Left' => __('Left','food-blogger-hub'),
            'Center' => __('Center','food-blogger-hub')
     ),
	) );

	// Pro Version
    $wp_customize->add_setting( 'food_blogger_hub_footer_widget_pro_version_logo', array(
        'sanitize_callback' => 'food_blogger_hub_sanitize_custom_control'
    ));
    $wp_customize->add_control( new food_blogger_hub_Customize_Pro_Version ( $wp_customize,'food_blogger_hub_footer_widget_pro_version_logo', array(
        'section'     => 'food_blogger_hub_footer_section',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Features ', 'food-blogger-hub' ),
        'description' => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL ),
        'priority'    => 100
    )));

	//footer
	$wp_customize->add_section('food_blogger_hub_footer_copyright_section',array(
		'title'	=> __('Footer Copyright Settings','food-blogger-hub'),
		'description'	=> __('Add copyright text.','food-blogger-hub'),
		'panel' => 'food_blogger_hub_panel_id',
		'priority' => 7,
	));

	$wp_customize->add_setting('food_blogger_hub_footer_text',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('food_blogger_hub_footer_text',array(
		'label'	=> __('Copyright Text','food-blogger-hub'),
		'section'	=> 'food_blogger_hub_footer_copyright_section',
		'type'		=> 'text'
	));

	//footer widget title font size
	$wp_customize->add_setting('food_blogger_hub_footer_copyright_font_size',array(
		'default'	=> '',
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_footer_copyright_font_size',array(
		'label'	=> __('Change Footer Copyright Font Size in PX','food-blogger-hub'),
		'section'	=> 'food_blogger_hub_footer_copyright_section',
	    'setting'	=> 'food_blogger_hub_footer_copyright_font_size',
		'type'	=> 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 0,
			'max'              => 50,
		),
	));

	$wp_customize->add_setting( 'food_blogger_hub_footer_copyright_text_color', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_footer_copyright_text_color', array(
			'label'     => __('Change Footer Copyright Text Color', 'food-blogger-hub'),
	    'section' => 'food_blogger_hub_footer_copyright_section',
	    'settings' => 'food_blogger_hub_footer_copyright_text_color',
  	)));

  	$wp_customize->add_setting('food_blogger_hub_footer_copyright_top_bottom_padding',array(
		'default'	=> '',
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_footer_copyright_top_bottom_padding',array(
		'label'	=> __('Change Footer Copyright Padding in PX','food-blogger-hub'),
		'section'	=> 'food_blogger_hub_footer_copyright_section',
	    'setting'	=> 'food_blogger_hub_footer_copyright_top_bottom_padding',
		'type'	=> 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 0,
			'max'              => 50,
		),
	));

	// Add Settings and Controls for copyright
	$wp_customize->add_setting('food_blogger_hub_copyright_text_position',array(
        'default' => 'Center',
        'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
	));
	$wp_customize->add_control('food_blogger_hub_copyright_text_position',array(
        'type' => 'radio',
        'label'     => __('Copyright Text Position', 'food-blogger-hub'),
        'description'   => __('This option work for Copyright', 'food-blogger-hub'),
        'section' => 'food_blogger_hub_footer_copyright_section',
        'choices' => array(
            'Right' => __('Right','food-blogger-hub'),
            'Left' => __('Left','food-blogger-hub'),
            'Center' => __('Center','food-blogger-hub')
        ),
	) );

	// Pro Version
    $wp_customize->add_setting( 'food_blogger_hub_copyright_pro_version_logo', array(
        'sanitize_callback' => 'food_blogger_hub_sanitize_custom_control'
    ));
    $wp_customize->add_control( new food_blogger_hub_Customize_Pro_Version ( $wp_customize,'food_blogger_hub_copyright_pro_version_logo', array(
        'section'     => 'food_blogger_hub_footer_copyright_section',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Features ', 'food-blogger-hub' ),
        'description' => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL ),
        'priority'    => 100
    )));

	$wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
	$wp_customize->selective_refresh->add_partial( 'blogname', array(
		'selector' => '.site-title a',
		'render_callback' => 'Food_Blogger_Hub_Customize_partial_blogname',
	) );
	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'render_callback' => 'Food_Blogger_Hub_Customize_partial_blogdescription',
	) );

	//Mobile Respnsive
	$wp_customize->add_section('food_blogger_hub_mobile_media_option',array(
		'title'         => __('Mobile Responsive media', 'food-blogger-hub'),
		'description' => __('Control will not function if the toggle in the main settings is off.', 'food-blogger-hub'),
		'priority' => 8,
		'panel' => 'food_blogger_hub_panel_id'
	) );

	$wp_customize->add_setting( 'food_blogger_hub_mobile_blog_description', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new food_blogger_hub_Toggle_Control( $wp_customize, 'food_blogger_hub_mobile_blog_description', array(
		'label'       => esc_html__( 'Show / Hide Blog Page Description', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_mobile_media_option',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_mobile_blog_description',
	) ) );

	$wp_customize->add_setting( 'food_blogger_hub_return_to_header_mob', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_return_to_header_mob', array(
		'label'       => esc_html__( 'Show / Hide Return to header', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_mobile_media_option',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_return_to_header_mob',
	) ) );
	$wp_customize->add_setting( 'food_blogger_hub_related_post_mob', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_related_post_mob', array(
		'label'       => esc_html__( 'Show / Hide Related Post', 'food-blogger-hub' ),
		'section'     => 'food_blogger_hub_mobile_media_option',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_related_post_mob',
	) ) );

	// Pro Version
    $wp_customize->add_setting( 'food_blogger_hub_responsive_pro_version_logo', array(
        'sanitize_callback' => 'food_blogger_hub_sanitize_custom_control'
    ));
    $wp_customize->add_control( new food_blogger_hub_Customize_Pro_Version ( $wp_customize,'food_blogger_hub_responsive_pro_version_logo', array(
        'section'     => 'food_blogger_hub_mobile_media_option',
        'type'        => 'pro_options',
        'label'       => esc_html__( 'Features ', 'food-blogger-hub' ),
        'description' => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL ),
        'priority'    => 100
    )));

	//Site Identity
	$wp_customize->add_setting( 'food_blogger_hub_site_title', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_site_title', array(
		'label'       => esc_html__( 'Show / Hide Site Title', 'food-blogger-hub' ),
		'section'     => 'title_tagline',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_site_title',
	) ) );

	$wp_customize->add_setting('food_blogger_hub_site_title_font_size',array(
		'default'	=> 30,
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_site_title_font_size',array(
		'label'	=> __('Site Title Font Size in PX','food-blogger-hub'),
		'section'	=> 'title_tagline',
		'setting'	=> 'food_blogger_hub_site_title_font_size',
		'type'	=> 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 0,
			'max'              => 80,
		),
	));

	$wp_customize->add_setting( 'food_blogger_hub_site_tagline_color', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_site_tagline_color', array(
			'label'     => __('Change Site Title Color', 'food-blogger-hub'),
	    'section' => 'title_tagline',
	    'settings' => 'food_blogger_hub_site_tagline_color',
  	)));

	$wp_customize->add_setting( 'food_blogger_hub_site_tagline', array(
	    'default'           => false,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_site_tagline', array(
		'label'       => esc_html__( 'Show / Hide Site Tagline', 'food-blogger-hub' ),
		'section'     => 'title_tagline',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_site_tagline',
	) ) );

	// logo site tagline size
	$wp_customize->add_setting('food_blogger_hub_site_tagline_font_size',array(
		'default'	=> 15,
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_site_tagline_font_size',array(
		'label'	=> __('Site Tagline Font Size in PX','food-blogger-hub'),
		'section'	=> 'title_tagline',
	    'setting'	=> 'food_blogger_hub_site_tagline_font_size',
		'type'	=> 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 0,
			'max'              => 50,
		),
	));

	$wp_customize->add_setting( 'food_blogger_hub_logo_tagline_color', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_logo_tagline_color', array(
			'label'     => __('Change Site Tagline Color', 'food-blogger-hub'),
	    'section' => 'title_tagline',
	    'settings' => 'food_blogger_hub_logo_tagline_color',
  	)));

    $wp_customize->add_setting('food_blogger_hub_logo_width',array(
		'default' => 50,
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_logo_width',array(
		'label'	=> esc_html__('Here You Can Customize Your Logo Size','food-blogger-hub'),
		'section'	=> 'title_tagline',
		'type'		=> 'number',
		'input_attrs' => array(
			'step'             => 1,
			'min'              => 0,
			'max'              => 150,
		),
	));

	//Woo Coomerce
	$wp_customize->add_setting('food_blogger_hub_per_columns',array(
		'default'=> 3,
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_per_columns',array(
		'label'	=> __('Product Per Row','food-blogger-hub'),
		'section'=> 'woocommerce_product_catalog',
		'type'=> 'number'
	));
	$wp_customize->add_setting('food_blogger_hub_product_per_page',array(
		'default'=> 9,
		'sanitize_callback'	=> 'food_blogger_hub_sanitize_number_absint'
	));
	$wp_customize->add_control('food_blogger_hub_product_per_page',array(
		'label'	=> __('Product Per Page','food-blogger-hub'),
		'section'=> 'woocommerce_product_catalog',
		'type'=> 'number'
	));
   	$wp_customize->add_setting( 'food_blogger_hub_product_sidebar', array(
		 'default'           => true,
		 'transport'         => 'refresh',
		 'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_product_sidebar', array(
		'label'       => esc_html__( 'Show / Hide Shop Page Sidebar', 'food-blogger-hub' ),
		'section'     => 'woocommerce_product_catalog',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_product_sidebar',
	) ) );

	$wp_customize->add_setting( 'food_blogger_hub_single_product_sidebar', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_single_product_sidebar', array(
		'label'       => esc_html__( 'Show / Hide Product Page Sidebar', 'food-blogger-hub' ),
		'section'     => 'woocommerce_product_catalog',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_single_product_sidebar',
	) ) );
	$wp_customize->add_setting( 'food_blogger_hub_related_product', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Food_Blogger_Hub_Toggle_Control( $wp_customize, 'food_blogger_hub_related_product', array(
		'label'       => esc_html__( 'Show / Hide related product', 'food-blogger-hub' ),
		'section'     => 'woocommerce_product_catalog',
		'type'        => 'toggle',
		'settings'    => 'food_blogger_hub_related_product',
	) ) );
	
	//add page template setting pannel
	$wp_customize->add_panel( 'food_blogger_hub_page_panel_id', array(
	    'priority' => 10,
	    'capability' => 'edit_theme_options',
	    'theme_supports' => '',
	    'title' => __( 'Page Template Settings', 'food-blogger-hub' ),
	    'description' => __( 'Description of what this panel does.', 'food-blogger-hub' ),
	) );

	// 404 PAGE
	$wp_customize->add_section('food_blogger_hub_404_page_section',array(
		'title'         => __('404 Page', 'food-blogger-hub'),
		'description'   => 'Here you can customize 404 Page content.',
		'panel' => 'food_blogger_hub_page_panel_id'
	) );

	$wp_customize->add_setting('food_blogger_hub_edit_404_title',array(
		'default'=> __('Oops! That page cant be found.','food-blogger-hub'),
		'sanitize_callback'	=> 'sanitize_text_field',
	));
	$wp_customize->add_control('food_blogger_hub_edit_404_title',array(
		'label'	=> __('Edit Title','food-blogger-hub'),
		'section'=> 'food_blogger_hub_404_page_section',
		'type'=> 'text',
	));

	$wp_customize->add_setting('food_blogger_hub_edit_404_text',array(
		'default'=> __('It looks like nothing was found at this location. Maybe try a search?','food-blogger-hub'),
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('food_blogger_hub_edit_404_text',array(
		'label'	=> __('Edit Text','food-blogger-hub'),
		'section'=> 'food_blogger_hub_404_page_section',
		'type'=> 'text'
	));

	// Search Results
	$wp_customize->add_section('food_blogger_hub_no_result_section',array(
		'title'         => __('Search Results', 'food-blogger-hub'),
		'description'   => 'Here you can customize Search Result content.',
		'panel' => 'food_blogger_hub_page_panel_id'
	) );

	$wp_customize->add_setting('food_blogger_hub_edit_no_result_title',array(
		'default'=> __('Nothing Found','food-blogger-hub'),
		'sanitize_callback'	=> 'sanitize_text_field',
	));
	$wp_customize->add_control('food_blogger_hub_edit_no_result_title',array(
		'label'	=> __('Edit Title','food-blogger-hub'),
		'section'=> 'food_blogger_hub_no_result_section',
		'type'=> 'text',
	));

	$wp_customize->add_setting('food_blogger_hub_edit_no_result_text',array(
		'default'=> __('Sorry, but nothing matched your search terms. Please try again with some different keywords.','food-blogger-hub'),
		'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('food_blogger_hub_edit_no_result_text',array(
		'label'	=> __('Edit Text','food-blogger-hub'),
		'section'=> 'food_blogger_hub_no_result_section',
		'type'=> 'text'
	));

	// Header Image Height
    $wp_customize->add_setting(
        'food_blogger_hub_header_image_height',
        array(
            'default'           => 350,
            'sanitize_callback' => 'absint',
        )
    );
    $wp_customize->add_control(
        'food_blogger_hub_header_image_height',
        array(
            'label'       => esc_html__( 'Header Image Height', 'food-blogger-hub' ),
            'section'     => 'header_image',
            'type'        => 'number',
            'description' => esc_html__( 'Control the height of the header image. Default is 350px.', 'food-blogger-hub' ),
            'input_attrs' => array(
                'min'  => 220,
                'max'  => 1000,
                'step' => 1,
            ),
        )
    );

    // Header Background Position
    $wp_customize->add_setting(
        'food_blogger_hub_header_background_position',
        array(
            'default'           => 'center',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );
    $wp_customize->add_control(
        'food_blogger_hub_header_background_position',
        array(
            'label'       => esc_html__( 'Header Background Position', 'food-blogger-hub' ),
            'section'     => 'header_image',
            'type'        => 'select',
            'choices'     => array(
                'top'    => esc_html__( 'Top', 'food-blogger-hub' ),
                'center' => esc_html__( 'Center', 'food-blogger-hub' ),
                'bottom' => esc_html__( 'Bottom', 'food-blogger-hub' ),
            ),
            'description' => esc_html__( 'Choose how you want to position the header image.', 'food-blogger-hub' ),
        )
    );

    // Header Image Parallax Effect
    $wp_customize->add_setting(
        'food_blogger_hub_header_background_attachment',
        array(
            'default'           => 1,
            'sanitize_callback' => 'absint',
        )
    );
    $wp_customize->add_control(
        'food_blogger_hub_header_background_attachment',
        array(
            'label'       => esc_html__( 'Header Image Parallax', 'food-blogger-hub' ),
            'section'     => 'header_image',
            'type'        => 'checkbox',
            'description' => esc_html__( 'Add a parallax effect on page scroll.', 'food-blogger-hub' ),
        )
    );

    //Opacity
	$wp_customize->add_setting('food_blogger_hub_header_banner_opacity_color',array(
       'default'              => '0.7',
       'sanitize_callback' => 'food_blogger_hub_sanitize_choices'
	));
    $wp_customize->add_control( 'food_blogger_hub_header_banner_opacity_color', array(
		'label'       => esc_html__( 'Header Image Opacity','food-blogger-hub' ),
		'section'     => 'header_image',
		'type'        => 'select',
		'settings'    => 'food_blogger_hub_header_banner_opacity_color',
		'choices' => array(
           '0' =>  esc_attr(__('0','food-blogger-hub')),
           '0.1' =>  esc_attr(__('0.1','food-blogger-hub')),
           '0.2' =>  esc_attr(__('0.2','food-blogger-hub')),
           '0.3' =>  esc_attr(__('0.3','food-blogger-hub')),
           '0.4' =>  esc_attr(__('0.4','food-blogger-hub')),
           '0.5' =>  esc_attr(__('0.5','food-blogger-hub')),
           '0.6' =>  esc_attr(__('0.6','food-blogger-hub')),
           '0.7' =>  esc_attr(__('0.7','food-blogger-hub')),
           '0.8' =>  esc_attr(__('0.8','food-blogger-hub')),
           '0.9' =>  esc_attr(__('0.9','food-blogger-hub'))
		), 
	) );

   $wp_customize->add_setting( 'food_blogger_hub_header_banner_image_overlay', array(
	    'default'   => true,
	    'transport' => 'refresh',
	    'sanitize_callback' => 'food_blogger_hub_sanitize_checkbox',
	));
	$wp_customize->add_control( new food_blogger_hub_Toggle_Control( $wp_customize, 'food_blogger_hub_header_banner_image_overlay', array(
	    'label'   => esc_html__( 'Show / Hide Header Image Overlay', 'food-blogger-hub' ),
	    'section' => 'header_image',
	)));

    $wp_customize->add_setting('food_blogger_hub_header_banner_image_ooverlay_color', array(
		'default'           => '#000',
		'sanitize_callback' => 'sanitize_hex_color',
	));
	$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'food_blogger_hub_header_banner_image_ooverlay_color', array(
		'label'    => __('Header Image Overlay Color', 'food-blogger-hub'),
		'section'  => 'header_image',
	)));

    $wp_customize->add_setting(
        'food_blogger_hub_header_image_title_font_size',
        array(
            'default'           => 32,
            'sanitize_callback' => 'absint',
        )
    );
    $wp_customize->add_control(
        'food_blogger_hub_header_image_title_font_size',
        array(
            'label'       => esc_html__( 'Change Header Image Title Font Size', 'food-blogger-hub' ),
            'section'     => 'header_image',
            'type'        => 'number',
            'description' => esc_html__( 'Control the font Size of the header image title. Default is 32px.', 'food-blogger-hub' ),
            'input_attrs' => array(
                'min'  => 10,
                'max'  => 200,
                'step' => 1,
            ),
        )
    );

	$wp_customize->add_setting( 'food_blogger_hub_header_image_title_text_color', array(
	    'default' => '',
	    'sanitize_callback' => 'sanitize_hex_color'
  	));
  	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'food_blogger_hub_header_image_title_text_color', array(
			'label'     => __('Change Header Image Title Color', 'food-blogger-hub'),
	    'section' => 'header_image',
	    'settings' => 'food_blogger_hub_header_image_title_text_color',
  	)));

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

/**
 * Render the site title for the selective refresh partial.
 *
 * @since Food Blogger Hub 1.0
 * @see Food_Blogger_Hub_Customize_register()
 *
 * @return void
 */
function Food_Blogger_Hub_Customize_partial_blogname() {
	bloginfo( 'name' );
}

/**
 * Render the site tagline for the selective refresh partial.
 *
 * @since Food Blogger Hub 1.0
 * @see Food_Blogger_Hub_Customize_register()
 *
 * @return void
 */
function Food_Blogger_Hub_Customize_partial_blogdescription() {
	bloginfo( 'description' );
}

if ( ! defined( 'FOOD_BLOGGER_HUB_PRO_THEME_NAME' ) ) {
	define( 'FOOD_BLOGGER_HUB_PRO_THEME_NAME', esc_html__( 'Food Blogger Hub Pro', 'food-blogger-hub' ));
}
if ( ! defined( 'FOOD_BLOGGER_HUB_PRO_THEME_URL' ) ) {
	define( 'FOOD_BLOGGER_HUB_PRO_THEME_URL', esc_url('https://www.themespride.com/products/foodie-blog-wordpress-theme'));
}
if ( ! defined( 'food_blogger_hub_DOCS_URL' ) ) {
	define( 'food_blogger_hub_DOCS_URL', esc_url('https://page.themespride.com/demo/docs/food-blogger-hub/'));
}
if ( ! defined( 'FOOD_BLOGGER_HUB_DOCS_URL' ) ) {
	define( 'FOOD_BLOGGER_HUB_DOCS_URL', esc_url('https://page.themespride.com/demo/docs/food-blogger-hub/'));
}


if ( ! defined( 'FOOD_BLOGGER_HUB_TEXT' ) ) {
    define( 'FOOD_BLOGGER_HUB_TEXT', __( 'Food Blogger Hub Pro','food-blogger-hub' ));
}
if ( ! defined( 'FOOD_BLOGGER_HUB_BUY_TEXT' ) ) {
    define( 'FOOD_BLOGGER_HUB_BUY_TEXT', __( 'Upgrade To Pro','food-blogger-hub' ));
}


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

// Load custom sections.
load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );

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

    $manager->add_section(
        new Food_Blogger_hub_Button( $manager, 'food_blogger_hub_pro', [
            'title'       => esc_html( FOOD_BLOGGER_HUB_TEXT,'food-blogger-hub' ),
            'priority'    => 0,
            'button_text' => __( 'GET PREMIUM', 'food-blogger-hub' ),
            'button_url'  => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL )
        ] )
    );

} );


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

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

		static $instance = null;

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

		return $instance;
	}

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

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

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

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

	/**
	 * Sets up the customizer sections.
	 *
	 * @since  1.0.0
	 * @access public
	 * @param  object  $manager
	 * @return void
	 */
	public function sections( $manager ) {

		// Load custom sections.
		load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );

		// Register custom section types.
		$manager->register_section_type( 'Food_Blogger_Hub_Customize_Section_Pro' );

		// Register sections.
		$manager->add_section(
			new Food_Blogger_Hub_Customize_Section_Pro(
				$manager,
				'food_blogger_hub_section_pro',
				array(
					'priority'   => 9,
					'title'    => FOOD_BLOGGER_HUB_PRO_THEME_NAME,
					'pro_text' => esc_html__( 'Upgrade Pro', 'food-blogger-hub' ),
					'pro_url'  => esc_url( FOOD_BLOGGER_HUB_PRO_THEME_URL, 'food-blogger-hub' ),
				)
			)
		);

		// Register sections.
		$manager->add_section(
			new food_blogger_hub_Customize_Section_Pro(
				$manager,
				'food_blogger_hub_documentation',
				array(
					'priority'   => 500,
					'title'    => esc_html__( 'Theme Documentation', 'food-blogger-hub' ),
					'pro_text' => esc_html__( 'Click Here', 'food-blogger-hub' ),
					'pro_url'  => esc_url( FOOD_BLOGGER_HUB_DOCS_URL, 'food-blogger-hub'),
				)
			)
		);

	}

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

		wp_enqueue_script( 'food-blogger-hub-customize-controls', trailingslashit( esc_url( get_template_directory_uri() ) ) . '/assets/js/customize-controls.js', array( 'customize-controls' ) );

		wp_enqueue_style( 'food-blogger-hub-customize-controls', trailingslashit( esc_url( get_template_directory_uri() ) ) . '/assets/css/customize-controls.css' );
	}
}

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