<?php
/**
 * The Pet Clinic: Customizer
 *
 * @subpackage The Pet Clinic
 * @since 1.0
 */

use WPTRT\Customize\Section\The_Pet_Clinic_Button;

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

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

	$manager->add_section(
		new The_Pet_Clinic_Button( $manager, 'the_pet_clinic_pro', [
			'title'       => __( 'Pet Clinic Pro', 'the-pet-clinic' ),
			'priority'    => 0,
			'button_text' => __( 'Go Pro', 'the-pet-clinic' ),
			'button_url'  => esc_url('https://www.luzuk.com/products/pet-care-wordpress-theme/')
		] )
	);

} );

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

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

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

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

} );

function the_pet_clinic_customize_register( $wp_customize ) {

	$wp_customize->add_setting('the_pet_clinic_logo_size',array(
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_logo_size',array(
		'type' => 'range',
		'label' => __('Logo Size','the-pet-clinic'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('the_pet_clinic_logo_padding',array(
		'sanitize_callback'	=> 'esc_html'
	));
	$wp_customize->add_control('the_pet_clinic_logo_padding',array(
		'label' => __('Logo Padding','the-pet-clinic'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting('the_pet_clinic_logo_top_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_logo_top_padding',array(
		'type' => 'number',
		'description' => __('Top','the-pet-clinic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('the_pet_clinic_logo_bottom_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_logo_bottom_padding',array(
		'type' => 'number',
		'description' => __('Bottom','the-pet-clinic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('the_pet_clinic_logo_left_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_logo_left_padding',array(
		'type' => 'number',
		'description' => __('Left','the-pet-clinic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('the_pet_clinic_logo_right_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_logo_right_padding',array(
		'type' => 'number',
		'description' => __('Right','the-pet-clinic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting( 'the_pet_clinic_site_logobg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_site_logobg_color', array(
		'label' => 'Logo Background Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_setting('the_pet_clinic_show_site_title',array(
		'default' => true,
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_checkbox'
	));
	$wp_customize->add_control('the_pet_clinic_show_site_title',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Title','the-pet-clinic'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting( 'the_pet_clinic_site_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_site_title_color', array(
		'label' => 'Title Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_setting('the_pet_clinic_site_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_site_title_font_size',array(
		'type' => 'number',
		'label' => __('Site Title Font Size','the-pet-clinic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_setting('the_pet_clinic_show_tagline',array(
		'default' => true,
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_checkbox'
	));
	$wp_customize->add_control('the_pet_clinic_show_tagline',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide Site Tagline','the-pet-clinic'),
		'section' => 'title_tagline'
	));

	$wp_customize->add_setting( 'the_pet_clinic_site_tagline_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_site_tagline_color', array(
		'label' => 'Tagline Color',
		'section' => 'title_tagline',
	)));

	$wp_customize->add_setting('the_pet_clinic_site_tagline_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_site_tagline_font_size',array(
		'type' => 'number',
		'label' => __('Site Tagline Font Size','the-pet-clinic'),
		'section' => 'title_tagline',
	));

	$wp_customize->add_panel( 'the_pet_clinic_panel_id', array(
		'priority' => 10,
		'capability' => 'edit_theme_options',
		'theme_supports' => '',
		'title' => __( 'Theme Settings', 'the-pet-clinic' ),
		'description' => __( 'Description of what this panel does.', 'the-pet-clinic' ),
	) );

	$wp_customize->add_section( 'the_pet_clinic_theme_options_section', array(
    	'title'      => __( 'General Settings', 'the-pet-clinic' ),
		'priority'   => 30,
		'panel' => 'the_pet_clinic_panel_id'
	) );

	// Add Settings and Controls for Layout
	$wp_customize->add_setting('the_pet_clinic_theme_options',array(
		'default' => 'Right Sidebar',
		'sanitize_callback' => 'the_pet_clinic_sanitize_choices'
	));
	$wp_customize->add_control('the_pet_clinic_theme_options',array(
		'type' => 'radio',
		'label' => __('Do you want this section','the-pet-clinic'),
		'section' => 'the_pet_clinic_theme_options_section',
		'choices' => array(
		   'Left Sidebar' => __('Left Sidebar','the-pet-clinic'),
		   'Right Sidebar' => __('Right Sidebar','the-pet-clinic'),
		   'One Column' => __('One Column','the-pet-clinic'),
		   'Three Columns' => __('Three Columns','the-pet-clinic'),
		   'Four Columns' => __('Four Columns','the-pet-clinic'),
		   'Grid Layout' => __('Grid Layout','the-pet-clinic')
		),
	));

	$wp_customize->add_setting( 'the_pet_clinic_boxfull_width', array(
		'default'           => '',
		'sanitize_callback' => 'the_pet_clinic_sanitize_choices'
	));
	
	$wp_customize->add_control( 'the_pet_clinic_boxfull_width', array(
		'label'    => __( 'Section Width', 'the-pet-clinic' ),
		'section'  => 'the_pet_clinic_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'container'  => __('Box Width', 'the-pet-clinic'),
			'container-fluid' => __('Full Width', 'the-pet-clinic'),
			'none' => __('None', 'the-pet-clinic')
		),
	));

	$wp_customize->add_setting( 'the_pet_clinic_dropdown_anim', array(
		'default'           => 'None',
		'sanitize_callback' => 'the_pet_clinic_sanitize_choices'
	));
	$wp_customize->add_control( 'the_pet_clinic_dropdown_anim', array(
		'label'    => __( 'Menu Dropdown Animations', 'the-pet-clinic' ),
		'section'  => 'the_pet_clinic_theme_options_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInUp'  => __('bounceInUp', 'the-pet-clinic'),
			'fadeInUp' => __('fadeInUp', 'the-pet-clinic'),
			'zoomIn'    => __('zoomIn', 'the-pet-clinic'),
			'None'    => __('None', 'the-pet-clinic')
		),
	));

	// Top Bar
	$wp_customize->add_section( 'the_pet_clinic_top_bar', array(
    	'title'      => __( 'Header Contact Details', 'the-pet-clinic' ),
		'priority'   => null,
		'panel' => 'the_pet_clinic_panel_id'
	) );

	$wp_customize->add_setting('the_pet_clinic_hide_show_topbar',array(
    	'default' => false,
    	'sanitize_callback'	=> 'the_pet_clinic_sanitize_checkbox'
	));
	$wp_customize->add_control('the_pet_clinic_hide_show_topbar',array(
   	'type' => 'checkbox',
   	'label' => __('Show / Hide Topbar','the-pet-clinic'),
   	'section' => 'the_pet_clinic_top_bar',
	));

	$wp_customize->add_setting('the_pet_clinic_email_address',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_email'
	));	
	$wp_customize->add_control('the_pet_clinic_email_address',array(
		'label'	=> __('Add Email Address','the-pet-clinic'),
		'section'=> 'the_pet_clinic_top_bar',
		'setting'=> 'the_pet_clinic_email_address',
		'type'=> 'text'
	));

	$wp_customize->add_setting('the_pet_clinic_email_address_text',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('the_pet_clinic_email_address_text',array(
		'label'	=> __('Add Email Address Text','the-pet-clinic'),
		'section'=> 'the_pet_clinic_top_bar',
		'setting'=> 'the_pet_clinic_email_address_text',
		'type'=> 'text'
	));

	$wp_customize->add_setting('the_pet_clinic_phone_number',array(
		'default'=> '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_phone_number'
	));	
	$wp_customize->add_control('the_pet_clinic_phone_number',array(
		'label'	=> __('Add Phone Number','the-pet-clinic'),
		'section'=> 'the_pet_clinic_top_bar',
		'setting'=> 'the_pet_clinic_phone_number',
		'type'=> 'text'
	));

	$wp_customize->add_setting('the_pet_clinic_phone_number_text',array(
		'default'=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('the_pet_clinic_phone_number_text',array(
		'label'	=> __('Add Phone Number Text','the-pet-clinic'),
		'section'=> 'the_pet_clinic_top_bar',
		'setting'=> 'the_pet_clinic_phone_number_text',
		'type'=> 'text'
	));

	$wp_customize->add_setting( 'the_pet_clinic_topicon_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_topicon_color', array(
		'label' => 'Top Icon Color',
		'section' => 'the_pet_clinic_top_bar',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_toptext_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_toptext_color', array(
		'label' => 'Top Text Color',
		'section' => 'the_pet_clinic_top_bar',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_topbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_topbg_color', array(
		'label' => 'Top Background Color',
		'section' => 'the_pet_clinic_top_bar',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_munu_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_munu_color', array(
		'label' => 'Menu Color',
		'section' => 'the_pet_clinic_top_bar',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_munuhvr_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_munuhvr_color', array(
		'label' => 'Menu Hover Color',
		'section' => 'the_pet_clinic_top_bar',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_munubg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_munubg_color', array(
		'label' => 'Background Color',
		'section' => 'the_pet_clinic_top_bar',
	)));


	//social icons
	$wp_customize->add_section( 'the_pet_clinic_social', array(
    	'title'      => __( 'Social Icons', 'the-pet-clinic' ),
		'priority'   => null,
		'panel' => 'the_pet_clinic_panel_id'
	) );

	$wp_customize->add_setting('the_pet_clinic_facebook_url',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('the_pet_clinic_facebook_url',array(
		'label'	=> __('Add Facebook link','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_social',
		'setting'	=> 'the_pet_clinic_facebook_url',
		'type'	=> 'url'
	));

	$wp_customize->add_setting('the_pet_clinic_twitter_url',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('the_pet_clinic_twitter_url',array(
		'label'	=> __('Add Twitter link','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_social',
		'setting'	=> 'the_pet_clinic_twitter_url',
		'type'	=> 'url'
	));

	$wp_customize->add_setting('the_pet_clinic_instagram_url',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('the_pet_clinic_instagram_url',array(
		'label'	=> __('Add Instagram link','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_social',
		'setting'	=> 'the_pet_clinic_instagram_url',
		'type'	=> 'url'
	));

	$wp_customize->add_setting('the_pet_clinic_youtube_url',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw'
	));	
	$wp_customize->add_control('the_pet_clinic_youtube_url',array(
		'label'	=> __('Add Youtube link','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_social',
		'setting'	=> 'the_pet_clinic_youtube_url',
		'type'	=> 'url'
	));

	$wp_customize->add_setting( 'the_pet_clinic_social_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_social_color', array(
		'label' => 'Social Icons Color',
		'section' => 'the_pet_clinic_social',
	)));

	//home page slider
	$wp_customize->add_section( 'the_pet_clinic_slider_section' , array(
    	'title'      => __( 'Slider Settings', 'the-pet-clinic' ),
		'priority'   => null,
		'panel' => 'the_pet_clinic_panel_id'
	) );

	$wp_customize->add_setting('the_pet_clinic_slider_hide_show',array(
    	'default' => false,
    	'sanitize_callback'	=> 'the_pet_clinic_sanitize_checkbox'
	));
	$wp_customize->add_control('the_pet_clinic_slider_hide_show',array(
		'type' => 'checkbox',
		'label' => __('Show / Hide slider','the-pet-clinic'),
		'description' => __('Image Size ( 1400px x 800px )','the-pet-clinic'),
		'section' => 'the_pet_clinic_slider_section',
	));

	$wp_customize->add_setting( 'the_pet_clinic_slider_effect', array(
		'default'           => '',
		'sanitize_callback' => 'the_pet_clinic_sanitize_choices'
	));
	$wp_customize->add_control( 'the_pet_clinic_slider_effect', array(
		'label'    => __( 'Onload Transactions Effects', 'the-pet-clinic' ),
		'section'  => 'the_pet_clinic_slider_section',
		'type'     => 'select',
		'choices'  => array(
			'bounceInLeft'  => __('bounceInLeft', 'the-pet-clinic'),
			'bounceInRight' => __('bounceInRight', 'the-pet-clinic'),
			'bounceInUp'    => __('bounceInUp', 'the-pet-clinic'),
			'bounceInDown'    => __('bounceInDown', 'the-pet-clinic'),
			'zoomIn'  => __('zoomIn', 'the-pet-clinic'),
			'zoomOut' => __('zoomOut', 'the-pet-clinic'),
			'fadeInDown'    => __('fadeInDown', 'the-pet-clinic'),
			'fadeInUp'    => __('fadeInUp', 'the-pet-clinic'),
			'fadeInLeft'  => __('fadeInLeft', 'the-pet-clinic'),
			'fadeInRight' => __('fadeInRight', 'the-pet-clinic'),
			'flip-up'    => __('flip-up', 'the-pet-clinic'),
			'none'    => __('none', 'the-pet-clinic')
		),
	));

	for ( $count = 1; $count <= 4; $count++ ) {
		$wp_customize->add_setting( 'the_pet_clinic_slider' . $count, array(
			'default'           => '',
			'sanitize_callback' => 'the_pet_clinic_sanitize_dropdown_pages'
		) );
		$wp_customize->add_control( 'the_pet_clinic_slider' . $count, array(
			'label'    => __( 'Select Slider Image Page', 'the-pet-clinic' ),
			'section'  => 'the_pet_clinic_slider_section',
			'type'     => 'dropdown-pages'
		) );
	}

	$wp_customize->add_setting('the_pet_clinic_slider_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_slider_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Font Size','the-pet-clinic'),
		'section' => 'the_pet_clinic_slider_section',
	));

	$wp_customize->add_setting('the_pet_clinic_slider_opacity',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_slider_opacity',array(
		'type' => 'range',
		'label' => __('Image Opacity','the-pet-clinic'),
		'section' => 'the_pet_clinic_slider_section',
		'input_attrs' => array(
			'min' => 0,
			'max' => 1,
			'step' => 0.1
		)		
	));

	$wp_customize->add_setting( 'the_pet_clinic_slider_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_slider_color', array(
		'label' => 'Title Color',
		'section' => 'the_pet_clinic_slider_section',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_sliderbtn_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_sliderbtn_color', array(
		'label' => 'Button Text Color',
		'section' => 'the_pet_clinic_slider_section',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_sliderbtnbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_sliderbtnbg_color', array(
		'label' => 'Button Bg Color',
		'section' => 'the_pet_clinic_slider_section',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_slidernp_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_slidernp_color', array(
		'label' => 'Next/Pre Arrow Color',
		'section' => 'the_pet_clinic_slider_section',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_slidernpbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_slidernpbg_color', array(
		'label' => 'Next/Pre Arrow Bg Color',
		'section' => 'the_pet_clinic_slider_section',
	)));

	// Our Facilities 
	$wp_customize->add_section('the_pet_clinic_facilities_section',array(
		'title'	=> __('Our Facilities','the-pet-clinic'),
		'description'=> __('<b>Note :</b> This section will appear below the Slider section.','the-pet-clinic'),
		'panel' => 'the_pet_clinic_panel_id',
	));

	$wp_customize->add_setting('the_pet_clinic_facilities_smalltitle',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('the_pet_clinic_facilities_smalltitle',array(
		'label'	=> __('Section Small Title','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_facilities_section',
		'setting'	=> 'the_pet_clinic_facilities_smalltitle',
		'type'		=> 'text'
	));
	
	$wp_customize->add_setting('the_pet_clinic_facilities_title',array(
		'default'	=> '',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('the_pet_clinic_facilities_title',array(
		'label'	=> __('Section Title','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_facilities_section',
		'setting'	=> 'the_pet_clinic_facilities_title',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('the_pet_clinic_facilities_small_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_facilities_small_font_size',array(
		'type' => 'number',
		'label' => __('Small Title Size','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

	$wp_customize->add_setting('the_pet_clinic_facilities_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_facilities_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Size','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

	$wp_customize->add_setting('the_pet_clinic_facilities_image',array(
		'default'	=> '',
		'sanitize_callback'	=> 'esc_url_raw',
	));
	$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'the_pet_clinic_facilities_image',array(
            'label' => __('Facility Image','the-pet-clinic'),
            'section' => 'the_pet_clinic_facilities_section',
            'settings' => 'the_pet_clinic_facilities_image'
	)));

	$wp_customize->add_setting('the_pet_clinic_facility_img_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_facility_img_size',array(
		'type' => 'number',
		'label' => __('Image Size','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

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

	$wp_customize->add_setting('the_pet_clinic_facilities_cat_left',array(
		'default'	=> 'select',
		'sanitize_callback' => 'the_pet_clinic_sanitize_choices',
	));
	$wp_customize->add_control('the_pet_clinic_facilities_cat_left',array(
		'type'    => 'select',
		'choices' => $cat_pst4,
		'label' => __('Select Category To Display Left Facilities Posts','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

	$wp_customize->add_setting('the_pet_clinic_facilities_cat_right',array(
		'default'	=> 'select',
		'sanitize_callback' => 'the_pet_clinic_sanitize_choices',
	));
	$wp_customize->add_control('the_pet_clinic_facilities_cat_right',array(
		'type'    => 'select',
		'choices' => $cat_pst4,
		'label' => __('Select Category To Display Right Facilities Posts','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

	$wp_customize->add_setting('the_pet_clinic_facilities_post_title_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_facilities_post_title_font_size',array(
		'type' => 'number',
		'label' => __('Title Size','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

	$wp_customize->add_setting('the_pet_clinic_facilities_post_text_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_facilities_post_text_font_size',array(
		'type' => 'number',
		'label' => __('Text Size','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

	$wp_customize->add_setting('the_pet_clinic_facility_section_padding',array(
      'default' => '',
      'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_facility_section_padding',array(
		'type' => 'number',
		'label' => __('Section Top Bottom Padding','the-pet-clinic'),
		'section' => 'the_pet_clinic_facilities_section',
	));

	$wp_customize->add_setting( 'the_pet_clinic_facilities_smalltitle_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_facilities_smalltitle_color', array(
		'label' => 'Small Title Color',
		'section' => 'the_pet_clinic_facilities_section',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_facilities_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_facilities_title_color', array(
		'label' => 'Title Color',
		'section' => 'the_pet_clinic_facilities_section',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_facilities_post_title_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_facilities_post_title_color', array(
		'label' => 'Post Title Color',
		'section' => 'the_pet_clinic_facilities_section',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_facilities_post_text_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_facilities_post_text_color', array(
		'label' => 'Post Text Color',
		'section' => 'the_pet_clinic_facilities_section',
	)));

	//Footer
 	$wp_customize->add_section( 'the_pet_clinic_footer', array(
    	'title'      => __( 'Footer Settings', 'the-pet-clinic' ),
		'priority'   => null,
		'panel' => 'the_pet_clinic_panel_id'
	) );

	$wp_customize->add_setting('the_pet_clinic_show_back_totop',array(
 		'default' => true,
   	'sanitize_callback'	=> 'the_pet_clinic_sanitize_checkbox'
	));
	$wp_customize->add_control('the_pet_clinic_show_back_totop',array(
   	'type' => 'checkbox',
   	'label' => __('Show / Hide Back to Top','the-pet-clinic'),
   	'section' => 'the_pet_clinic_footer'
	));

 	$wp_customize->add_setting('the_pet_clinic_footer_link',array(
		'default'	=> 'https://www.luzuk.com/products/free-pet-care-wordpress-theme/',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('the_pet_clinic_footer_link',array(
		'label'	=> __('Footer Link','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_footer',
		'setting'	=> 'the_pet_clinic_footer_link',
		'type'		=> 'text'
	));

	$wp_customize->add_setting('the_pet_clinic_footer_copy',array(
		'default'	=> 'Pet Clinic WordPress Theme By Luzuk',
		'sanitize_callback'	=> 'sanitize_text_field'
	));	
	$wp_customize->add_control('the_pet_clinic_footer_copy',array(
		'label'	=> __('Footer Text','the-pet-clinic'),
		'section'	=> 'the_pet_clinic_footer',
		'setting'	=> 'the_pet_clinic_footer_copy',
		'type'		=> 'text'
	));
	
	$wp_customize->add_setting('the_pet_clinic_footer_copy_font_size',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
	));
	$wp_customize->add_control('the_pet_clinic_footer_copy_font_size',array(
		'type' => 'number',
		'label' => __('Font Size','the-pet-clinic'),
		'section' => 'the_pet_clinic_footer',
	));

	$wp_customize->add_setting('the_pet_clinic_copyright_padding',array(
		'default' => '',
		'sanitize_callback'	=> 'the_pet_clinic_sanitize_float'
 	));
 	$wp_customize->add_control('the_pet_clinic_copyright_padding',array(
		'type' => 'number',
		'label' => __('Copyright Top Bottom Padding','the-pet-clinic'),
		'section' => 'the_pet_clinic_footer',
	));

	$wp_customize->add_setting( 'the_pet_clinic_footer_widgets_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_footer_widgets_color', array(
		'label' => 'Widgets Title Color',
		'section' => 'the_pet_clinic_footer',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_footer_widgets_menus_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_footer_widgets_menus_color', array(
		'label' => 'Widgets Menus Color',
		'section' => 'the_pet_clinic_footer',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_copyright_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_copyright_color', array(
		'label' => 'Copyright Text Color',
		'section' => 'the_pet_clinic_footer',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_copyrightbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_copyrightbg_color', array(
		'label' => 'Copyright Bg Color',
		'section' => 'the_pet_clinic_footer',
	)));

	$wp_customize->add_setting( 'the_pet_clinic_footerbg_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'the_pet_clinic_footerbg_color', array(
		'label' => 'Footer Bg Color',
		'section' => 'the_pet_clinic_footer',
	)));

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

	$wp_customize->selective_refresh->add_partial( 'blogname', array(
		'selector' => '.site-title a',
		'render_callback' => 'the_pet_clinic_customize_partial_blogname',
	) );
	$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
		'selector' => '.site-description',
		'render_callback' => 'the_pet_clinic_customize_partial_blogdescription',
	) );
}
add_action( 'customize_register', 'the_pet_clinic_customize_register' );

function the_pet_clinic_customize_partial_blogname() {
	bloginfo( 'name' );
}

function the_pet_clinic_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

function the_pet_clinic_is_static_front_page() {
	return ( is_front_page() && ! is_home() );
}

function the_pet_clinic_is_view_with_layout_option() {
	// This option is available on all pages. It's also available on archives when there isn't a sidebar.
	return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) );
}