<?php
/**
 * Home Gardening Theme Customizer
 *
 * @package Home Gardening
 */

// Customize Controls.
require get_template_directory() . '/inc/custom-settings-control/customize-controls.php';

// Customize Controls.
require get_template_directory() . '/inc/custom-range-controls.php';

// Sanitization For Customize Controls.
require get_template_directory() . '/inc/custom-settings-control/sanitization.php';

/**
 * Provide postMessage support for the Theme Customizer's site title and description.
 */
function home_gardening_customize_register( $wp_customize ) {

	// General Settings Panel.
    $wp_customize->add_panel( 'home_gardening_general_settings_panel',
        array(
            'title'      => esc_html__( 'General Settings', 'home-gardening' ),
            'priority'   => 2,
            'capability' => 'edit_theme_options',
        )
    );

    // Header Settings Panel.
    $wp_customize->add_panel( 'home_gardening_header_settings_panel',
        array(
            'title'      => esc_html__( 'Header Settings', 'home-gardening' ),
            'priority'   => 2,
            'capability' => 'edit_theme_options',
        )
    );

    // Frontpage Sections Settings Panel.
    $wp_customize->add_panel( 'home_gardening_frontpage_sections_settings_panel',
        array(
            'title'      => esc_html__( 'Frontpage Sections Settings', 'home-gardening' ),
            'priority'   => 3,
            'capability' => 'edit_theme_options',
        )
    );

    // Footer Settings Panel.
    $wp_customize->add_panel( 'home_gardening_footer_settings_panel',
        array(
            'title'      => esc_html__( 'Footer Settings', 'home-gardening' ),
            'priority'   => 3,
            'capability' => 'edit_theme_options',
        )
    );

    // Site Identity

	$wp_customize->get_section( 'title_tagline' )->panel = 'home_gardening_header_settings_panel';

	$wp_customize->add_setting(
		'home_gardening_site_logo',
		array(
			'default'           => false,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_site_logo',
			array(
				'label'    => esc_html__( 'ON / OFF Site Logo', 'home-gardening' ),
				'section'  => 'title_tagline',
				'settings' => 'home_gardening_site_logo',
			)
		)
	);

	$wp_customize->add_setting(
		'home_gardening_site_title_text',
		array(
			'default'           => true,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_site_title_text',
			array(
				'label'    => esc_html__( 'ON / OFF Site Title', 'home-gardening' ),
				'section'  => 'title_tagline',
				'settings' => 'home_gardening_site_title_text',
			)
		)
	);

$wp_customize->add_setting(
		'home_gardening_site_title_font_size',
		array(
			'default'	=> 20,
			'sanitize_callback' => 'home_gardening_sanitize_number_range',
		)
	);

	$wp_customize->add_control(
		new home_gardening_Slider(
			$wp_customize,
			'home_gardening_site_title_font_size',
			array(
				'label'    => esc_html__( ' Site Title Font Size', 'home-gardening' ),
				'section'  => 'title_tagline',
				'label' => esc_html__('Site Title Font Size', 'home-gardening'),
    			'input_attrs' => array(
					'reset'			   => 20,
		            'step'             => 1,
					'min'              => 0,
					'max'              => 50,
		        ),
			)
		)
	);

	$wp_customize->add_setting(
		'home_gardening_site_tagline_text',
		array(
			'default'           => false,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_site_tagline_text',
			array(
				'label'    => esc_html__( 'ON / OFF Site Tagline', 'home-gardening' ),
				'section'  => 'title_tagline',
				'settings' => 'home_gardening_site_tagline_text',
			)
		)
	);

	$wp_customize->add_setting(
        'home_gardening_site_tagline_font_size',
        array(
            'default'   => 15,
            'sanitize_callback' => 'home_gardening_sanitize_number_range',
        )
    );

    $wp_customize->add_control(
        new home_gardening_Slider(
            $wp_customize,
            'home_gardening_site_tagline_font_size',
            array(
                'label'    => esc_html__( 'Site Tagline Font Size', 'home-gardening' ),
                'section'  => 'title_tagline',
                'label' => esc_html__('Site Tagline Font Size', 'home-gardening'),
                'input_attrs' => array(
					'reset'			   => 15,
		            'step'             => 1,
					'min'              => 0,
					'max'              => 50,
		        ),
            )
        )
    );

//Woo Coomerce
    $wp_customize->add_setting('home_gardening_per_columns',array(
        'default'=> 3,
        'sanitize_callback' => 'home_gardening_sanitize_number_absint'
    ));
    $wp_customize->add_control('home_gardening_per_columns',array(
        'label' => __('Product Per Row','home-gardening'),
        'section'=> 'woocommerce_product_catalog',
        'type'=> 'number',
        'input_attrs' => array(
            'min' => 1,
            'max' => 6,
            'step' => 1,
        ),
    ));
    $wp_customize->add_setting('home_gardening_product_per_page',array(
        'default'=> 10,
        'sanitize_callback' => 'home_gardening_sanitize_number_absint'
    ));
    $wp_customize->add_control('home_gardening_product_per_page',array(
        'label' => __('Product Per Page','home-gardening'),
        'section'=> 'woocommerce_product_catalog',
        'type'=> 'number',
        'input_attrs' => array(
            'min' => 1,
            'max' => 20,
            'step' => 1,
        ),
    ));

    $wp_customize->add_section(
		'woocommerce_product_extra_section',
		array(
			'panel'      => 'woocommerce',
			'title'    => esc_html__( 'Extra WooCommerce Settings', 'home-gardening' ),
		)
	);

    $wp_customize->add_setting( 'home_gardening_single_product_sidebar', array(
		'default'           => true,
		'transport'         => 'refresh',
		'sanitize_callback' => 'home_gardening_sanitize_checkbox',
	) );
	$wp_customize->add_control( new Home_Gardening_On_Off_Custom_Control( $wp_customize, 'home_gardening_single_product_sidebar', array(
		'label'       => esc_html__( 'Show / Hide Product Page Sidebar', 'home-gardening' ),
		'section'     => 'woocommerce_product_extra_section',
		'type'        => 'toggle',
		'settings'    => 'home_gardening_single_product_sidebar',
	) ) );


	// Header Options

	$wp_customize->add_section(
		'home_gardening_header_section',
		array(
			'panel'      => 'home_gardening_header_settings_panel',
			'title'    => esc_html__( 'Header Options', 'home-gardening' ),
		)
	);

		//MENU TYPOGRAPHY
	

	

	$wp_customize->add_setting('home_gardening_menu_font_weight',array(
        'default' => '',
        'sanitize_callback' => 'home_gardening_sanitize_choices'
	));
	$wp_customize->add_control('home_gardening_menu_font_weight',array(
     'type' => 'radio',
     'label'     => __('Menu Font Weight', 'home-gardening'),
     'section' => 'home_gardening_header_section',
     'type' => 'select',
     'choices' => array(
         '100' => __('100','home-gardening'),
         '200' => __('200','home-gardening'),
         '300' => __('300','home-gardening'),
         '400' => __('400','home-gardening'),
         '500' => __('500','home-gardening'),
         '600' => __('600','home-gardening'),
         '700' => __('700','home-gardening'),
         '800' => __('800','home-gardening'),
         '900' => __('900','home-gardening')
     ),
	) );
	
	$wp_customize->add_setting('home_gardening_menu_text_tranform',array(
		'default' => 'Capitalize',
		'sanitize_callback' => 'home_gardening_sanitize_choices'
 	));
 	$wp_customize->add_control('home_gardening_menu_text_tranform',array(
		'type' => 'select',
		'label' => __('Menu Text Transform','home-gardening'),
		'section' => 'home_gardening_header_section',
		'choices' => array(
		   'Uppercase' => __('Uppercase','home-gardening'),
		   'Lowercase' => __('Lowercase','home-gardening'),
		   'Capitalize' => __('Capitalize','home-gardening'),
		),
	) );
	$wp_customize->add_setting('home_gardening_menu_font_size', array(
	    'default'	=> 16,
        'sanitize_callback' => 'home_gardening_sanitize_number_range',
	));
	$wp_customize->add_control(new home_gardening_Slider($wp_customize, 'home_gardening_menu_font_size', array(
        'section' => 'home_gardening_header_section',
        'label' => esc_html__('Menu Font Size', 'home-gardening'),
        'input_attrs' => array(
					'reset'			   => 16,
		            'step'             => 1,
					'min'              => 0,
					'max'              => 35,
		        ),
	)));

	$wp_customize->add_setting(
		'home_gardening_sticky_header',
		array(
			'default'           => false,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_sticky_header',
			array(
				'label'    => esc_html__( 'ON / OFF Sticky Header', 'home-gardening' ),
				'section'  => 'home_gardening_header_section',
				'settings' => 'home_gardening_sticky_header',
			)
		)
	);

    $wp_customize->add_setting(
		'home_gardening_topbar_section_on_off_setting',
		array(
			'default'           => true,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_topbar_section_on_off_setting',
			array(
				'label'    => esc_html__( 'ON / OFF Topbar Section', 'home-gardening' ),
				'section'  => 'home_gardening_header_section',
				'settings' => 'home_gardening_topbar_section_on_off_setting',
			)
		)
	);

	$wp_customize->add_setting(
        'home_gardening_phone_number',
        array(
            'default'           => '+1234567890',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

	$wp_customize->add_control(
        'home_gardening_phone_number',
        array(
            'label'           => sprintf( esc_html__( 'Add Phone Number', 'home-gardening' ), ),
            'section'         => 'home_gardening_header_section',
            'settings'        => 'home_gardening_phone_number' ,
            'type'            => 'text',
        )
    );

    $wp_customize->add_setting(
        'home_gardening_email_address',
        array(
            'default'           => 'info@example.com',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'home_gardening_email_address',
        array(
            'label'           => sprintf( esc_html__( 'Add Email Address', 'home-gardening' ), ),
            'section'         => 'home_gardening_header_section',
            'settings'        => 'home_gardening_email_address' ,
            'type'            => 'text',
        )
    );

    $wp_customize->add_setting(
        'home_gardening_address',
        array(
            'default'           => '6391 Eligin xyz street, LA',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

	$wp_customize->add_control(
        'home_gardening_address',
        array(
            'label'           => sprintf( esc_html__( 'Add Address', 'home-gardening' ), ),
            'section'         => 'home_gardening_header_section',
            'settings'        => 'home_gardening_address' ,
            'type'            => 'text',
        )
    );

    $wp_customize->add_setting(
        'home_gardening_header_button_text',
        array(
            'default'           => 'Request A Quote',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'home_gardening_header_button_text',
        array(
            'label'           => sprintf( esc_html__( 'Add Button Text', 'home-gardening' ), ),
            'section'         => 'home_gardening_header_section',
            'settings'        => 'home_gardening_header_button_text' ,
            'type'            => 'text',
        )
    );

    $wp_customize->add_setting(
        'home_gardening_header_button_url',
        array(
            'default'           => '#',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'home_gardening_header_button_url',
        array(
            'label'           => sprintf( esc_html__( 'Add Button Link', 'home-gardening' ), ),
            'section'         => 'home_gardening_header_section',
            'settings'        => 'home_gardening_header_button_url' ,
            'type'            => 'url',
        )
    );

	// Social Options

	$wp_customize->add_section(
		'home_gardening_social_section',
		array(
			'panel'      => 'home_gardening_header_settings_panel',
			'title'    => esc_html__( 'Social Options', 'home-gardening' ),
		)
	);

    $wp_customize->add_setting(
        'home_gardening_facebook_url',
        array(
            'default'           => '#',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

	$wp_customize->add_control(
        'home_gardening_facebook_url',
        array(
            'label'           => sprintf( esc_html__( 'Add Facebook Link', 'home-gardening' ), ),
            'section'         => 'home_gardening_social_section',
            'settings'        => 'home_gardening_facebook_url' ,
            'type'            => 'url',
        )
    );

	$wp_customize->add_setting(
        'home_gardening_twitter_url',
        array(
            'default'           => '#',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

	$wp_customize->add_control(
        'home_gardening_twitter_url',
        array(
            'label'           => sprintf( esc_html__( 'Add Twitter Link', 'home-gardening' ), ),
            'section'         => 'home_gardening_social_section',
            'settings'        => 'home_gardening_twitter_url' ,
            'type'            => 'url',
        )
    );

    $wp_customize->add_setting(
        'home_gardening_instagram_url',
        array(
            'default'           => '#',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

	$wp_customize->add_control(
        'home_gardening_instagram_url',
        array(
            'label'           => sprintf( esc_html__( 'Add Instagram Link', 'home-gardening' ), ),
            'section'         => 'home_gardening_social_section',
            'settings'        => 'home_gardening_instagram_url' ,
            'type'            => 'url',
        )
    );

    $wp_customize->add_setting(
        'home_gardening_youtube_url',
        array(
            'default'           => '#',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

	$wp_customize->add_control(
        'home_gardening_youtube_url',
        array(
            'label'           => sprintf( esc_html__( 'Add Youtube Link', 'home-gardening' ), ),
            'section'         => 'home_gardening_social_section',
            'settings'        => 'home_gardening_youtube_url' ,
            'type'            => 'url',
        )
    );

	$wp_customize->add_setting(
        'home_gardening_whatsapp_url',
        array(
            'default'           => '#',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

	$wp_customize->add_control(
        'home_gardening_whatsapp_url',
        array(
            'label'           => sprintf( esc_html__( 'Add Whatsapp Link', 'home-gardening' ), ),
            'section'         => 'home_gardening_social_section',
            'settings'        => 'home_gardening_whatsapp_url' ,
            'type'            => 'url',
        )
    );
	
	// Banner Options

	$wp_customize->add_section(
		'home_gardening_banner_section',
		array(
			'panel'      => 'home_gardening_frontpage_sections_settings_panel',
			'title'    => esc_html__( 'Banner Options', 'home-gardening' ),
		)
	);

    $wp_customize->add_setting(
		'home_gardening_banner_section_on_off_setting',
		array(
			'default'           => false,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_banner_section_on_off_setting',
			array(
				'label'    => esc_html__( 'ON / OFF Banner Section', 'home-gardening' ),
				'section'  => 'home_gardening_banner_section',
				'settings' => 'home_gardening_banner_section_on_off_setting',
			)
		)
	);

	$wp_customize->add_setting(
	    'home_gardening_slider',
	    array(
	        'default'           => '',
	        'sanitize_callback' => 'home_gardening_sanitize_number',
	    )
	);

	$wp_customize->add_control(
	    'home_gardening_slider',
	    array(
	        'label'       => esc_html__( 'No of banner', 'home-gardening' ),
	        'section'     => 'home_gardening_banner_section',
	        'settings'    => 'home_gardening_slider',
	        'type'        => 'number',
	        'input_attrs' => array(
	            'min' => 1,
	            'max' => 3,
	        ),
	    )
	);

	$home_gardening_banner = get_theme_mod( 'home_gardening_slider');
	for ( $i = 1; $i <= $home_gardening_banner; $i++ ){
		$wp_customize->add_setting(
			'home_gardening_banner_heading_text'.$i,
			array(
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'home_gardening_banner_heading_text'.$i,
			array(
				'label'           => sprintf( esc_html__( 'Banner Heading Text 0', 'home-gardening' ).$i, ),
				'section'         => 'home_gardening_banner_section',
				'settings'        => 'home_gardening_banner_heading_text'.$i,
				'type'            => 'text',
			)
		);

		$wp_customize->add_setting(
			'home_gardening_banner_heading'.$i,
			array(
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'home_gardening_banner_heading'.$i,
			array(
				'label'           => sprintf( esc_html__( 'Banner Heading 0', 'home-gardening' ).$i, ),
				'section'         => 'home_gardening_banner_section',
				'settings'        => 'home_gardening_banner_heading'.$i,
				'type'            => 'text',
			)
		);

		$wp_customize->add_setting(
			'home_gardening_banner_content'.$i,
			array(
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'home_gardening_banner_content'.$i,
			array(
				'label'           => sprintf( esc_html__( 'Banner Content 0', 'home-gardening' ).$i, ),
				'section'         => 'home_gardening_banner_section',
				'settings'        => 'home_gardening_banner_content'.$i,
				'type'            => 'text',
			)
		);

        $wp_customize->add_setting(
            'home_gardening_banner_btn'.$i,
            array(
                'default'           => '',
                'sanitize_callback' => 'sanitize_text_field',
            )
        );

        $wp_customize->add_control(
            'home_gardening_banner_btn'.$i,
            array(
                'label'           => sprintf( esc_html__( 'Banner Button 0', 'home-gardening' ).$i, ),
                'section'         => 'home_gardening_banner_section',
                'settings'        => 'home_gardening_banner_btn'.$i,
                'type'            => 'text',
            )
        );

		$wp_customize->add_setting(
			'home_gardening_banner_button_link'.$i,
			array(
				'default'           => '',
				'sanitize_callback' => 'esc_url_raw',
			)
		);

		$wp_customize->add_control(
			'home_gardening_banner_button_link'.$i,
			array(
				'label'           => sprintf( esc_html__( 'Banner Button Link 0', 'home-gardening' ).$i, ),
				'section'         => 'home_gardening_banner_section',
				'settings'        => 'home_gardening_banner_button_link'.$i,
				'type'            => 'url',
			)
		);
		
		$wp_customize->add_setting(
			'home_gardening_banner_image'.$i,
			array(
	        	'default'           => '',
	        	'sanitize_callback' => 'home_gardening_sanitize_image',

	    	)
	    );
	    
	    $wp_customize->add_control(
	     	new WP_Customize_Image_Control(
	    		$wp_customize, 'home_gardening_banner_image'.$i, 
	    		array(
	    			'label'           => sprintf( esc_html__( 'Banner Image 0', 'home-gardening' ).$i, ),
			        'settings'  => 'home_gardening_banner_image'.$i,
			        'section'   => 'home_gardening_banner_section'
	    		) 
	    	)
	    );
	}

	// Video Option

	$wp_customize->add_section(
		'home_gardening_video_section',
		array(
			'panel'      => 'home_gardening_frontpage_sections_settings_panel',
			'title'    => esc_html__( 'Video Options', 'home-gardening' ),
		)
	);

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

	$wp_customize->add_control(
        'home_gardening_video_count',
        array(
            'label'           => sprintf( esc_html__( 'Add Number Count', 'home-gardening' ), ),
            'section'         => 'home_gardening_video_section',
            'settings'        => 'home_gardening_video_count' ,
            'type'            => 'text',
        )
    );

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

	$wp_customize->add_control(
        'home_gardening_video_count_text',
        array(
        	'label'           => sprintf( esc_html__( 'Add Count Text', 'home-gardening' ), ),            
            'section'         => 'home_gardening_video_section',
            'settings'        => 'home_gardening_video_count_text' ,
            'type'            => 'text',
        )
    );

    $wp_customize->add_setting(
        'home_gardening_video_embed_url',
        array(
            'default'           => '#',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

	$wp_customize->add_control(
        'home_gardening_video_embed_url',
        array(
            'label'           => sprintf( esc_html__( 'Add Video Embed Url', 'home-gardening' ), ),
            'description'     => esc_url( 'https://www.youtube.com/embed/9xwazD5SyVg', 'home-gardening' ),
            'section'         => 'home_gardening_video_section',
            'settings'        => 'home_gardening_video_embed_url' ,
            'type'            => 'url',
        )
    );

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

	$wp_customize->add_control(
        'home_gardening_video_rightside_text',
        array(
        	'label'           => sprintf( esc_html__( 'Add Extra Text', 'home-gardening' ), ),            
            'section'         => 'home_gardening_video_section',
            'settings'        => 'home_gardening_video_rightside_text' ,
            'type'            => 'text',
        )
    );

    // Garden Services Option

	$wp_customize->add_section(
		'home_gardening_services_section',
		array(
			'panel'      => 'home_gardening_frontpage_sections_settings_panel',
			'title'    => esc_html__( 'Garden Services Options', 'home-gardening' ),
		)
	);

    $wp_customize->add_setting(
		'home_gardening_services_section_on_off_setting',
		array(
			'default'           => false,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_services_section_on_off_setting',
			array(
				'label'    => esc_html__( 'ON / OFF Services Section', 'home-gardening' ),
				'section'  => 'home_gardening_services_section',
				'settings' => 'home_gardening_services_section_on_off_setting',
			)
		)
	);

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

    $wp_customize->add_control(
        'home_gardening_services_short_title',
        array(
            'label'           => sprintf( esc_html__( 'Services Short Content', 'home-gardening' ), ),
            'section'         => 'home_gardening_services_section',
            'settings'        => 'home_gardening_services_short_title' ,
            'type'            => 'text',
        )
    );

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

	$wp_customize->add_control(
        'home_gardening_services_title',
        array(
            'label'           => sprintf( esc_html__( 'Services Heading', 'home-gardening' ), ),
            'section'         => 'home_gardening_services_section',
            'settings'        => 'home_gardening_services_title' ,
            'type'            => 'text',
        )
    );    

    $wp_customize->add_setting(
	    'home_gardening_services_count',
	    array(
	        'default'           => '',
	        'sanitize_callback' => 'home_gardening_sanitize_number',
	    )
	);

	$wp_customize->add_control(
	    'home_gardening_services_count',
	    array(
	        'label'       => esc_html__( 'No of Services', 'home-gardening' ),
	        'section'     => 'home_gardening_services_section',
	        'settings'    => 'home_gardening_services_count',
	        'type'        => 'number',
	        'input_attrs' => array(
	            'min' => 1,
	            'max' => 8,
	        ),
	    )
	);

	$home_gardening_services = get_theme_mod( 'home_gardening_services_count');
	for ( $i = 1; $i <= $home_gardening_services; $i++ ){

		$wp_customize->add_setting(
			'home_gardening_services_image'.$i,
			array(
	        	'default'           => '',
	        	'sanitize_callback' => 'home_gardening_sanitize_image',

	    	)
	    );
	    
	    $wp_customize->add_control(
	     	new WP_Customize_Image_Control(
	    		$wp_customize, 'home_gardening_services_image'.$i, 
	    		array(
	    			'label'           => sprintf( esc_html__( 'Service Image 0', 'home-gardening' ).$i, ),
			        'settings'  => 'home_gardening_services_image'.$i,
			        'section'   => 'home_gardening_services_section'
	    		) 
	    	)
	    );

        $wp_customize->add_setting(
            'home_gardening_services_icon'.$i,
            array(
                'default'           => '',
                'sanitize_callback' => 'sanitize_text_field',
            )
        );

        $wp_customize->add_control(
            'home_gardening_services_icon'.$i,
            array(
                'label'           => sprintf( esc_html__( 'Service Icon 0', 'home-gardening' ).$i, ),
                'section'         => 'home_gardening_services_section',
                'settings'        => 'home_gardening_services_icon'.$i,
                'type'            => 'text',
            )
        );

		$wp_customize->add_setting(
			'home_gardening_services_heading'.$i,
			array(
				'default'           => '',
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			'home_gardening_services_heading'.$i,
			array(
				'label'           => sprintf( esc_html__( 'Service Heading 0', 'home-gardening' ).$i, ),
				'section'         => 'home_gardening_services_section',
				'settings'        => 'home_gardening_services_heading'.$i,
				'type'            => 'text',
			)
		);

        $wp_customize->add_setting(
            'home_gardening_service_btn'.$i,
            array(
                'default'           => '',
                'sanitize_callback' => 'sanitize_text_field',
            )
        );

        $wp_customize->add_control(
            'home_gardening_service_btn'.$i,
            array(
                'label'           => sprintf( esc_html__( 'Service Button Text 0', 'home-gardening' ).$i, ),
                'section'         => 'home_gardening_services_section',
                'settings'        => 'home_gardening_service_btn'.$i,
                'type'            => 'text',
            )
        );

        $wp_customize->add_setting(
            'home_gardening_service_button_link'.$i,
            array(
                'default'           => '',
                'sanitize_callback' => 'sanitize_text_field',
            )
        );

        $wp_customize->add_control(
            'home_gardening_service_button_link'.$i,
            array(
                'label'           => sprintf( esc_html__( 'Service Button Link 0', 'home-gardening' ).$i, ),
                'section'         => 'home_gardening_services_section',
                'settings'        => 'home_gardening_service_button_link'.$i,
                'type'            => 'text',
            )
        );
	}

	// Global Color Options

	$wp_customize->add_section(
		'home_gardening_global_color_section',
		array(
			'panel'      => 'home_gardening_general_settings_panel',
			'title'    => esc_html__( 'Global Color Options', 'home-gardening' ),
		)
	);

	$wp_customize->add_setting(
		'home_gardening_global_color',
		array(
			'default'           => '#F47771',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'home_gardening_global_color',
			array(
				'label'    => __( 'Global Color', 'home-gardening' ),
				'section'  => 'home_gardening_global_color_section',
			)
		)
	);

	// Global Font Family Options

	$wp_customize->add_section(
		'home_gardening_global_font_section',
		array(
			'panel'      => 'home_gardening_general_settings_panel',
			'title'    => esc_html__( 'Global Font Family Options', 'home-gardening' ),
		)
	);

	$wp_customize->add_setting(
		'home_gardening_global_font_setting',
		array(
			'default'           => '',
			'sanitize_callback' => 'home_gardening_sanitize_google_fonts',
		)
	);
	
	$wp_customize->add_control(
		'home_gardening_global_font_setting',
		array(
			'label'    => esc_html__( 'Global Font Family', 'home-gardening' ),
			'section'  => 'home_gardening_global_font_section',
			'settings' => 'home_gardening_global_font_setting',
			'type'     => 'select',
			'choices'  => home_gardening_get_all_google_font_families(),
		)
	);	

	// Global Color Options

	$wp_customize->add_section(
		'home_gardening_global_color_section',
		array(
			'panel'      => 'home_gardening_general_settings_panel',
			'title'    => esc_html__( 'Global Color Options', 'home-gardening' ),
		)
	);

	$wp_customize->add_setting(
		'home_gardening_global_color',
		array(
			'default'           => '#a5c32d',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'home_gardening_global_color',
			array(
				'label'    => __( 'Global Color One', 'home-gardening' ),
				'section'  => 'home_gardening_global_color_section',
			)
		)
	);

	$wp_customize->add_setting(
		'home_gardening_global_colortwo',
		array(
			'default'           => '#2a7d2e',
			'sanitize_callback' => 'sanitize_hex_color',
		)
	);
	
	$wp_customize->add_control(
		new WP_Customize_Color_Control(
			$wp_customize,
			'home_gardening_global_colortwo',
			array(
				'label'    => __( 'Global Color Two', 'home-gardening' ),
				'section'  => 'home_gardening_global_color_section',
			)
		)
	);

	// Global Font Family Options

	$wp_customize->add_section(
		'home_gardening_global_font_section',
		array(
			'panel'      => 'home_gardening_general_settings_panel',
			'title'    => esc_html__( 'Global Font Family Options', 'home-gardening' ),
		)
	);

	$wp_customize->add_setting(
		'home_gardening_global_font_setting',
		array(
			'default'           => '',
			'sanitize_callback' => 'home_gardening_sanitize_google_fonts',
		)
	);
	
	$wp_customize->add_control(
		'home_gardening_global_font_setting',
		array(
			'label'    => esc_html__( 'Global Font Family', 'home-gardening' ),
			'section'  => 'home_gardening_global_font_section',
			'settings' => 'home_gardening_global_font_setting',
			'type'     => 'select',
			'choices'  => home_gardening_get_all_google_font_families(),
		)
	);	

	$wp_customize->add_setting(
		'home_gardening_global_font_settingone',
		array(
			'default'           => '',
			'sanitize_callback' => 'home_gardening_sanitize_google_fonts',
		)
	);
	
	$wp_customize->add_control(
		'home_gardening_global_font_settingone',
		array(
			'label'    => esc_html__( 'Global Heading Font Family', 'home-gardening' ),
			'section'  => 'home_gardening_global_font_section',
			'settings' => 'home_gardening_global_font_settingone',
			'type'     => 'select',
			'choices'  => home_gardening_get_all_google_font_families(),
		)
	);	

    // Footer Option

    $wp_customize->add_section(
        'home_gardening_footer_widgets_section',
        array(
            'panel'      => 'home_gardening_footer_settings_panel',
            'title'    => esc_html__( 'Footer Widgets Options', 'home-gardening' ),
        )
    );

    $wp_customize->add_setting(
        'home_gardening_footer_widgets_section_on_off_setting',
        array(
            'default'           => true,
            'sanitize_callback' => 'home_gardening_sanitize_on_off',
        )
    );

    $wp_customize->add_control(
        new Home_Gardening_On_Off_Custom_Control(
            $wp_customize,
            'home_gardening_footer_widgets_section_on_off_setting',
            array(
                'label'    => esc_html__( 'ON / OFF Footer Widgets', 'home-gardening' ),
                'section'  => 'home_gardening_footer_widgets_section',
                'settings' => 'home_gardening_footer_widgets_section_on_off_setting',
            )
        )
    );

   $wp_customize->add_setting( 'home_gardening_footer_widget_background_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'home_gardening_footer_widget_background_color', array(
		'label'     => __('Footer Widget Background Color', 'home-gardening'),
		'description' => __('It will change the complete footer widget background color.', 'home-gardening'),
		'section' => 'home_gardening_footer_widgets_section',
		'settings' => 'home_gardening_footer_widget_background_color',
	)));

	$wp_customize->add_setting('home_gardening_footer_widget_background_image',array(
		'default'   => '',
		'sanitize_callback' => 'esc_url_raw',
	));
	$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize,'home_gardening_footer_widget_background_image',array(
		'label' => __('Footer Widget Background Image','home-gardening'),
		'section' => 'home_gardening_footer_widgets_section'
	)));

	$wp_customize->add_setting('home_gardening_footer_widget_text_position',array(
        'default' => 'Left',
        'sanitize_callback' => 'home_gardening_sanitize_choices'
    ));
    $wp_customize->add_control('home_gardening_footer_widget_text_position',array(
        'type' => 'radio',
        'label'     => __('Footer Widget Position', 'home-gardening'),
        'description'   => __('This option work for footer widget', 'home-gardening'),
		'section' => 'home_gardening_footer_widgets_section',
		'choices' => array(
            'Right' => __('Right','home-gardening'),
            'Left' => __('Left','home-gardening'),
            'Center' => __('Center','home-gardening')
     ),
    ) );
	
    $wp_customize->add_section(
        'home_gardening_copyright_section',
        array(
            'panel'      => 'home_gardening_footer_settings_panel',
            'title'    => esc_html__( 'Copyright Options', 'home-gardening' ),
        )
    );

	$wp_customize->add_setting(
		'home_gardening_copyright_section_on_off_setting',
		array(
			'default'           => true,
			'sanitize_callback' => 'home_gardening_sanitize_on_off',
		)
	);

	$wp_customize->add_control(
		new Home_Gardening_On_Off_Custom_Control(
			$wp_customize,
			'home_gardening_copyright_section_on_off_setting',
			array(
				'label'    => esc_html__( 'ON / OFF Copyright', 'home-gardening' ),
				'section'  => 'home_gardening_copyright_section',
				'settings' => 'home_gardening_copyright_section_on_off_setting',
			)
		)
	);

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

    $wp_customize->add_control(
        'home_gardening_footer_text',
        array(
            'label'           => sprintf( esc_html__( 'Edit Copyright Text', 'home-gardening' ), ),
            'section'         => 'home_gardening_copyright_section',
            'settings'        => 'home_gardening_footer_text' ,
            'type'            => 'text',
        )
    );

	$wp_customize->add_setting( 'home_gardening_footer_copyright_background_color', array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color'
	));
	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'home_gardening_footer_copyright_background_color', array(
		'label'     => __('Copyright Background Color', 'home-gardening'),
		'description' => __('It will change the complete copyright background color.', 'home-gardening'),
		'section' => 'home_gardening_copyright_section',
		'settings' => 'home_gardening_footer_copyright_background_color',
	)));

	$wp_customize->add_setting('home_gardening_copyright_text_position',array(
        'default' => 'Center',
        'sanitize_callback' => 'home_gardening_sanitize_choices'
    ));
    $wp_customize->add_control('home_gardening_copyright_text_position',array(
        'type' => 'radio',
        'label'     => __('Copyright Position', 'home-gardening'),
        'description'   => __('This option work for copyright', 'home-gardening'),
		'section' => 'home_gardening_copyright_section',
		'choices' => array(
            'Right' => __('Right','home-gardening'),
            'Left' => __('Left','home-gardening'),
            'Center' => __('Center','home-gardening')
     ),
    ) );

    // Add Settings and Controls for Scroll top
	$wp_customize->add_setting('home_gardening_scroll_top_position',array(
        'default' => 'Right',
        'sanitize_callback' => 'home_gardening_sanitize_choices'
	));
	$wp_customize->add_control('home_gardening_scroll_top_position',array(
        'type' => 'radio',
        'label'     => __('Scroll to top Position', 'home-gardening'),
        'description'   => __('This option work for scroll to top', 'home-gardening'),
       'section' => 'home_gardening_copyright_section',
       'choices' => array(
            'Right' => __('Right','home-gardening'),
            'Left' => __('Left','home-gardening'),
            'Center' => __('Center','home-gardening')
     ),
	) );
    
}
add_action( 'customize_register', 'home_gardening_customize_register' );

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

/**
 * Create the website's slogan for the partial selective refresh.
 *
 * @return void
 */
function home_gardening_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

/**
 * Singleton class for handling the theme's customizer integration.
 *
 * @since  1.0.0
 * @access public
 */
final class Home_Gardening_Customize_Buttons {
	/**
	 * Returns the instance.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return object
	 */
	public static function Home_Gardening_get_instance() {

		static $home_gardening_instance = null;

		if ( is_null( $home_gardening_instance ) ) {
			$home_gardening_instance = new self;
			$home_gardening_instance->Home_Gardening_setup_actions();
		}

		return $home_gardening_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 Home_Gardening_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  $home_gardening_manager
	 * @return void
	*/
	public function sections( $home_gardening_manager ) {
		load_template( trailingslashit( get_template_directory() ) . '/inc/home-gardening-section-pro.php' );

		$home_gardening_manager->register_section_type( 'Home_Gardening_Customize_Section_Pro' );

		$home_gardening_manager->add_section( new Home_Gardening_Customize_Section_Pro( $home_gardening_manager,'home_gardening_buy_now', array(
			'priority'   => 1,
			'title'    => esc_html__( 'Buy Home Gardening Pro', 'home-gardening' ),
			'pro_text' => esc_html__( 'Buy Pro Theme', 'home-gardening' ),
			'pro_url'    => esc_url( HOME_GARDENING_BUY_NOW ),
		) )	);

		$home_gardening_manager->add_section( new Home_Gardening_Customize_Section_Pro( $home_gardening_manager, 'home_gardening_live_demo', array(
		    'priority'   => 1,
		    'title'      => esc_html__( 'Preview Pro Theme', 'home-gardening' ),
		    'pro_text'   => esc_html__( 'View Live Demo', 'home-gardening' ),
		    'pro_url'    => esc_url( HOME_GARDENING_LIVE_DEMO ),
		) ) );	
	}

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

		wp_enqueue_script( 'home-gardening-customize-controls', trailingslashit( get_template_directory_uri() ) . '/assets/js/customize-controls.js', array( 'customize-controls' ) );

		wp_enqueue_style( 'home-gardening-customize-controls', trailingslashit( get_template_directory_uri() ) . '/assets/css/customize-controls.css' );
	}
}
Home_Gardening_Customize_Buttons::Home_Gardening_get_instance();