<?php
/**
 * General Settings
 *
 * @package Wellness_Coach_Lite
 */

function wellness_coach_lite_customize_register_general( $wp_customize ){
    
    /** General Settings */
    $wp_customize->add_panel( 
        'general_settings',
         array(
            'priority'    => 60,
            'capability'  => 'edit_theme_options',
            'title'       => __( 'General Settings', 'wellness-coach-lite' ),
            'description' => __( 'Customize Header, Social, Sharing, SEO, Post/Page, Newsletter, Performance and Miscellaneous settings.', 'wellness-coach-lite' ),
        ) 
    );
    
    /** Header Settings */
    $wp_customize->add_section(
        'header_settings',
        array(
            'title'    => __( 'Header Settings', 'wellness-coach-lite' ),
            'priority' => 20,
            'panel'    => 'general_settings',
        )
    );

    
    /** Shopping Cart */
    $wp_customize->add_setting( 
        'ed_shopping_cart', 
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Wellness_Coach_Lite_Toggle_Control( 
			$wp_customize,
			'ed_shopping_cart',
			array(
				'section'         => 'header_settings',
				'label'	          => __( 'Shopping Cart', 'wellness-coach-lite' ),
                'description'     => __( 'Enable to show Shopping cart in the header.', 'wellness-coach-lite' ),
                'active_callback' => 'wellness_coach_lite_is_woocommerce_activated'
			)
		)
	);
        
    /** Phone */
    $wp_customize->add_setting(
        'phone',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'phone',
        array(
            'type'    => 'text',
            'section' => 'header_settings',
            'label'   => __( 'Phone', 'wellness-coach-lite' ),
        )
    );

    $wp_customize->selective_refresh->add_partial( 'phone', array(
        'selector' => 'header .phone a',
        'render_callback' => 'wellness_coach_lite_get_header_phone',
    ) );
    
    /** Email */
    $wp_customize->add_setting(
        'email',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_email',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'email',
        array(
            'type'    => 'text',
            'section' => 'header_settings',
            'label'   => __( 'Email', 'wellness-coach-lite' ),
        )
    );

    $wp_customize->selective_refresh->add_partial( 'email', array(
        'selector' => 'header .email a',
        'render_callback' => 'wellness_coach_lite_get_header_email',
    ) );

    $wp_customize->add_setting(
        'header_contact_button',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'header_contact_button',
        array(
            'label'           => __( 'Button Label', 'wellness-coach-lite' ),
            'section'         => 'header_settings',
            'type'            => 'text',
        )
    );

    $wp_customize->selective_refresh->add_partial( 'header_contact_button', array(
        'selector' => 'header .header-button-wrap a',
        'render_callback' => 'wellness_coach_lite_get_header_contact_button',
    ) );

    $wp_customize->add_setting(
        'header_contact_url',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw', 
        )
    );
    
    $wp_customize->add_control(
        'header_contact_url',
        array(
            'label'           => __( 'Button URL', 'wellness-coach-lite' ),
            'section'         => 'header_settings',
            'type'            => 'url',
        )
    );

    /** Enable Header new tab */
    $wp_customize->add_setting( 
        'ed_header_new_tab', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_header_new_tab',
            array(
                'section'         => 'header_settings',
                'label'           => __( 'Enable the link in a new tab', 'wellness-coach-lite' ),
                'description'     => __( 'Enable to open link in new tab.', 'wellness-coach-lite' ),
            )
        )
    );

    /** Header Settings Ends */

    /** SEO Settings */
    $wp_customize->add_section(
        'seo_settings',
        array(
            'title'    => __( 'SEO Settings', 'wellness-coach-lite' ),
            'priority' => 40,
            'panel'    => 'general_settings',
        )
    );
    
    /** Enable Social Links */
    $wp_customize->add_setting( 
        'ed_post_update_date', 
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_post_update_date',
            array(
                'section'     => 'seo_settings',
                'label'       => __( 'Enable Last Update Post Date', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show last updated post date on listing as well as in single post.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Enable Social Links */
    $wp_customize->add_setting( 
        'ed_breadcrumb', 
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_breadcrumb',
            array(
                'section'     => 'seo_settings',
                'label'       => __( 'Enable Breadcrumb', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show breadcrumb in inner pages.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Breadcrumb Home Text */
    $wp_customize->add_setting(
        'home_text',
        array(
            'default'           => __( 'Home', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field' 
        )
    );
    
    $wp_customize->add_control(
        'home_text',
        array(
            'type'    => 'text',
            'section' => 'seo_settings',
            'label'   => __( 'Breadcrumb Home Text', 'wellness-coach-lite' ),
        )
    );  
    /** SEO Settings Ends */

    /** Social Media Settings */
    $wp_customize->add_section(
        'social_media_settings',
        array(
            'title'    => __( 'Social Media Settings', 'wellness-coach-lite' ),
            'priority' => 30,
            'panel'    => 'general_settings',
        )
    );
    
    /** Enable Social Links */
    $wp_customize->add_setting( 
        'ed_social_links', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_social_links',
            array(
                'section'     => 'social_media_settings',
                'label'       => __( 'Enable Social Links', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show social links at header.', 'wellness-coach-lite' ),
            )
        )
    );
    
    $wp_customize->add_setting( 
        new Wellness_Coach_Lite_Repeater_Setting( 
            $wp_customize, 
            'social_links', 
            array(
                'default' => '',
                'sanitize_callback' => array( 'Wellness_Coach_Lite_Repeater_Setting', 'sanitize_repeater_setting' ),
            ) 
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Control_Repeater(
            $wp_customize,
            'social_links',
            array(
                'section' => 'social_media_settings',               
                'label'   => __( 'Social Links', 'wellness-coach-lite' ),
                'fields'  => array(
                    'font' => array(
                        'type'        => 'font',
                        'label'       => __( 'Font Awesome Icon', 'wellness-coach-lite' ),
                        'description' => __( 'Example: fab fa-facebook-f', 'wellness-coach-lite' ),
                    ),
                    'link' => array(
                        'type'        => 'url',
                        'label'       => __( 'Link', 'wellness-coach-lite' ),
                        'description' => __( 'Example: https://facebook.com', 'wellness-coach-lite' ),
                    )
                ),
                'row_label' => array(
                    'type' => 'field',
                    'value' => __( 'links', 'wellness-coach-lite' ),
                    'field' => 'link'
                )                        
            )
        )
    );
    /** Social Media Settings Ends */

    /** Posts(Blog) & Pages Settings */
    $wp_customize->add_section(
        'post_page_settings',
        array(
            'title'    => __( 'Posts(Blog) & Pages Settings', 'wellness-coach-lite' ),
            'priority' => 50,
            'panel'    => 'general_settings',
        )
    );
    
    /** Prefix Archive Page */
    $wp_customize->add_setting( 
        'ed_prefix_archive', 
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_prefix_archive',
            array(
                'section'     => 'post_page_settings',
                'label'	      => __( 'Hide Prefix in Archive Page', 'wellness-coach-lite' ),
                'description' => __( 'Enable to hide prefix in archive page.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Blog Post Image Crop */
    $wp_customize->add_setting( 
        'ed_crop_blog', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_crop_blog',
            array(
                'section'     => 'post_page_settings',
                'label'       => __( 'Blog Post Image Crop', 'wellness-coach-lite' ),
                'description' => __( 'Enable to avoid automatic cropping of featured image in home, archive and search posts.', 'wellness-coach-lite' ),
            )
        )
    );

    /** Blog Excerpt */
    $wp_customize->add_setting( 
        'ed_excerpt', 
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_excerpt',
            array(
                'section'     => 'post_page_settings',
                'label'	      => __( 'Enable Blog Excerpt', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show excerpt or disable to show full post content.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Excerpt Length */
    $wp_customize->add_setting( 
        'excerpt_length', 
        array(
            'default'           => 30,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_number_absint'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Slider_Control( 
            $wp_customize,
            'excerpt_length',
            array(
                'section'	  => 'post_page_settings',
                'label'		  => __( 'Excerpt Length', 'wellness-coach-lite' ),
                'description' => __( 'Automatically generated excerpt length (in words).', 'wellness-coach-lite' ),
                'choices'	  => array(
                    'min' 	=> 10,
                    'max' 	=> 100,
                    'step'	=> 5,
                )                 
            )
        )
    );

    $wp_customize->add_setting(
        'blog_main_title',
        array(
            'default'           => __( 'From My Blog', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'blog_main_title',
        array(
            'label'   => __( 'Blog Title', 'wellness-coach-lite' ),
            'section' => 'post_page_settings',
            'type'    => 'text',
            'active_callback' => 'wellness_coach_lite_post_page_ac'
        )
    );

    $wp_customize->selective_refresh->add_partial( 'blog_main_title', array(
        'selector' => '.blog .section-header .page-title',
        'render_callback' => 'wellness_coach_lite_get_blog_main_title',
    ) );

    $wp_customize->add_setting(
        'blog_main_content',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_textarea_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'blog_main_content',
        array(
            'label'           => __( 'Blog Description', 'wellness-coach-lite' ),
            'section'         => 'post_page_settings',
            'type'            => 'textarea',
            'active_callback' => 'wellness_coach_lite_post_page_ac'
        )
    );

    $wp_customize->selective_refresh->add_partial( 'blog_main_content', array(
        'selector' => '.blog .section-header .section-desc',
        'render_callback' => 'wellness_coach_lite_get_blog_main_content',
    ) );
    
    /** Note */
    $wp_customize->add_setting(
        'post_note_text',
        array(
            'default'           => '',
            'sanitize_callback' => 'wp_kses_post' 
        )
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Note_Control( 
            $wp_customize,
            'post_note_text',
            array(
                'section'	  => 'post_page_settings',
                'description' => sprintf( __( '%s These options affect your individual posts.', 'wellness-coach-lite' ), '<hr/>' ),
            )
        )
    );

    /** Single Post Image Crop */
    $wp_customize->add_setting( 
        'ed_crop_single', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_crop_single',
            array(
                'section'     => 'post_page_settings',
                'label'       => __( 'Single Post Image Crop', 'wellness-coach-lite' ),
                'description' => __( 'Enable to avoid automatic cropping of featured image in single post.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Hide Author Section */
    $wp_customize->add_setting( 
        'ed_author', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_author',
            array(
                'section'     => 'post_page_settings',
                'label'	      => __( 'Hide Author Section', 'wellness-coach-lite' ),
                'description' => __( 'Enable to hide author section.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Author Section title */
    $wp_customize->add_setting(
        'author_title',
        array(
            'default'           => __( 'About The Author', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'author_title',
        array(
            'type'    => 'text',
            'section' => 'post_page_settings',
            'label'   => __( 'Author Section Title', 'wellness-coach-lite' ),
        )
    );
    
    $wp_customize->selective_refresh->add_partial( 'author_title', array(
        'selector' => '.author-section .author-section-title',
        'render_callback' => 'wellness_coach_lite_get_author_title',
    ) );

    /** Show Related Posts */
    $wp_customize->add_setting( 
        'ed_related', 
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_related',
            array(
                'section'     => 'post_page_settings',
                'label'	      => __( 'Show Related Posts', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show related posts in single page.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Related Posts section title */
    $wp_customize->add_setting(
        'related_post_title',
        array(
            'default'           => __( 'You may also like...', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'related_post_title',
        array(
            'type'            => 'text',
            'section'         => 'post_page_settings',
            'label'           => __( 'Related Posts Section Title', 'wellness-coach-lite' ),
            'active_callback' => 'wellness_coach_lite_post_page_ac'
        )
    );
    
    $wp_customize->selective_refresh->add_partial( 'related_post_title', array(
        'selector' => '.related-posts .title',
        'render_callback' => 'wellness_coach_lite_get_related_title',
    ) );
    
    /** Comments */
    $wp_customize->add_setting(
        'ed_comments',
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox',
        )
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_comments',
            array(
                'section'     => 'post_page_settings',
                'label'       => __( 'Show Comments', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show Comments in Single Post/Page.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Comments Below Post Content */
    $wp_customize->add_setting(
        'toggle_comments',
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox',
        )
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'toggle_comments',
            array(
                'section'         => 'post_page_settings',
                'label'           => __( 'Comments Below Post Content', 'wellness-coach-lite' ),
                'description'     => __( 'Enable to show comment section right after post content. Refresh site for changes.', 'wellness-coach-lite' ),
                'active_callback' => 'wellness_coach_lite_post_page_ac'
            )
        )
    );
    
    /** Hide Category */
    $wp_customize->add_setting( 
        'ed_category', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_category',
            array(
                'section'     => 'post_page_settings',
                'label'	      => __( 'Hide Category', 'wellness-coach-lite' ),
                'description' => __( 'Enable to hide category.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Hide Post Author */
    $wp_customize->add_setting( 
        'ed_post_author', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_post_author',
            array(
                'section'     => 'post_page_settings',
                'label'	      => __( 'Hide Post Author', 'wellness-coach-lite' ),
                'description' => __( 'Enable to hide post author.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Hide Posted Date */
    $wp_customize->add_setting( 
        'ed_post_date', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_post_date',
            array(
                'section'     => 'post_page_settings',
                'label'	      => __( 'Hide Posted Date', 'wellness-coach-lite' ),
                'description' => __( 'Enable to hide posted date.', 'wellness-coach-lite' ),
            )
        )
    );
    
    /** Show Featured Image */
    $wp_customize->add_setting( 
        'ed_featured_image', 
        array(
            'default'           => true,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_featured_image',
            array(
                'section'     => 'post_page_settings',
                'label'       => __( 'Show Featured Image', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show featured image in post detail (single post).', 'wellness-coach-lite' ),
            )
        )
    );

    /** Posts(Blog) & Pages Settings Ends */
    
    /** Newsletter Settings */
    $wp_customize->add_section(
        'newsletter_settings',
        array(
            'title'    => __( 'Newsletter Settings', 'wellness-coach-lite' ),
            'priority' => 65,
            'panel'    => 'general_settings',
        )
    );
    
    if( wellness_coach_lite_is_btnw_activated() ){
        
        /** Enable Newsletter Section */
        $wp_customize->add_setting( 
            'ed_newsletter', 
            array(
                'default'           => false,
                'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
            ) 
        );
        
        $wp_customize->add_control(
            new Wellness_Coach_Lite_Toggle_Control( 
                $wp_customize,
                'ed_newsletter',
                array(
                    'section'     => 'newsletter_settings',
                    'label'       => __( 'Newsletter Section', 'wellness-coach-lite' ),
                    'description' => __( 'Enable to show Newsletter Section', 'wellness-coach-lite' ),
                )
            )
        );
        
        /** Newsletter Shortcode */
        $wp_customize->add_setting(
            'newsletter_shortcode',
            array(
                'default'           => '',
                'sanitize_callback' => 'wp_kses_post',
            )
        );
        
        $wp_customize->add_control(
            'newsletter_shortcode',
            array(
                'type'        => 'text',
                'section'     => 'newsletter_settings',
                'label'       => __( 'Newsletter Shortcode', 'wellness-coach-lite' ),
                'description' => __( 'Enter the BlossomThemes Email Newsletters Shortcode. Ex. [BTEN id="356"]', 'wellness-coach-lite' ),
            )
        ); 
    } else {
        $wp_customize->add_setting(
            'newsletter_recommend',
            array(
                'sanitize_callback' => 'wp_kses_post',
            )
        );

        $wp_customize->add_control(
            new Wellness_Coach_Lite_Plugin_Recommend_Control(
                $wp_customize,
                'newsletter_recommend',
                array(
                    'section'     => 'newsletter_settings',
                    'label'       => __( 'Newsletter Shortcode', 'wellness-coach-lite' ),
                    'capability'  => 'install_plugins',
                    'plugin_slug' => 'blossomthemes-email-newsletter',//This is the slug of recommended plugin.
                    'description' => sprintf( __( 'Please install and activate the recommended plugin %1$sBlossomThemes Email Newsletter%2$s. After that option related with this section will be visible.', 'wellness-coach-lite' ), '<strong>', '</strong>' ),
                )
            )
        );
    }
    /** Newsletter Settings Ends */

    /** Instagram Settings */
    $wp_customize->add_section(
        'instagram_settings',
        array(
            'title'    => __( 'Instagram Settings', 'wellness-coach-lite' ),
            'priority' => 70,
            'panel'    => 'general_settings',
        )
    );
    
    /** Enable Instagram Section */
    $wp_customize->add_setting( 
        'ed_instagram', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_instagram',
            array(
                'section'     => 'instagram_settings',
                'label'       => __( 'Instagram Section', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show Instagram Section', 'wellness-coach-lite' ),
            )
        )
    );

    $wp_customize->add_setting( 
        'instagram_shortcode', 
        array(
            'default'           =>'[instagram-feed]',
            'sanitize_callback' => 'sanitize_text_field'
        ) 
    );

    $wp_customize->add_control(
        'instagram_shortcode',
        array(
            'section'         => 'instagram_settings',
            'label'           => __( 'Shortcode', 'wellness-coach-lite' ),
            'type'            => 'text',
            'description'     => __( 'Add shortcode for your instagram profile below:', 'wellness-coach-lite' ),
            'active_callback' => 'wellness_coach_lite_ed_instagram'
        )
    );   

    /** Instagram Settings Ends */

    /** Blog Settings */
    $wp_customize->add_section( 
        'blog_page_settings',
            array(
            'priority'    => 70,
            'capability'  => 'edit_theme_options',
            'title'       => __( 'Blog Page Settings', 'wellness-coach-lite' ),
            'panel'    => 'general_settings',
            ) 
    );

    $wp_customize->add_setting( 
        'ed_blog_featured_post', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Wellness_Coach_Lite_Toggle_Control( 
			$wp_customize,
			'ed_blog_featured_post',
			array(
				'section'     => 'blog_page_settings',
				'label'	      => __( 'Show featured posts', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show featured posts in blog layout one and three.', 'wellness-coach-lite' ),             
            )
		)
	);

    $wp_customize->add_setting(
        'featured_post_title',
        array(
            'default'           => __( 'FEATURED', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'featured_post_title',
        array(
            'type'            => 'text',
            'section'         => 'blog_page_settings',
            'label'           => __( 'Featured Post Title', 'wellness-coach-lite' ),
            'active_callback' => 'wellness_coach_lite_top_pick_ac',
        )
    );

    $wp_customize->selective_refresh->add_partial( 'featured_post_title', array(
        'selector'        => '.container .post .content-wrap span.sub-title',
        'render_callback' => 'wellness_coach_get_featured_title',
    ) );

    $wp_customize->add_setting(
        'blog_featured_post',
        array(
            'default'           => '',
            'sanitize_callback' => 'wellness_coach_lite_sanitize_select'
        )
    );

    $wp_customize->add_control(
        new Wellness_Coach_Lite_Select_Control(
            $wp_customize,
            'blog_featured_post',
            array(
                'label'           => __( 'Blog Featured Post', 'wellness-coach-lite' ),
                'description'     => __( 'Select a featured posts for blog layout one and three.', 'wellness-coach-lite' ),
                'section'         => 'blog_page_settings',
                'choices'         => wellness_coach_lite_get_posts(),
                'active_callback' => 'wellness_coach_lite_top_pick_ac',

            )
        )
    );

    /** Read More Text */
    $wp_customize->add_setting(
        'read_more_text',
        array(
            'default'           => __( 'Read More', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'read_more_text',
        array(
            'type'            => 'text',
            'section'         => 'blog_page_settings',
            'label'           => __( 'Read More Text', 'wellness-coach-lite' ),
            'active_callback' => 'wellness_coach_lite_top_pick_ac',
        )
    );
    
    $wp_customize->selective_refresh->add_partial( 'read_more_text', array(
        'selector'        => '.blog .button-wrap .btn-link',
        'render_callback' => 'wellness_coach_lite_get_read_more',
    ) );

    $wp_customize->add_setting( 
        'ed_top_picks', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Wellness_Coach_Lite_Toggle_Control( 
			$wp_customize,
			'ed_top_picks',
			array(
				'section'     => 'blog_page_settings',
				'label'	      => __( 'Show top picks', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show top picks in blog layout one, two and three.', 'wellness-coach-lite' ),             
            )
		)
	);

    $wp_customize->add_setting(
        'top_pick_label',
        array(
            'default'           => __( 'Top Picks', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'top_pick_label',
        array(
            'type'            => 'text',
            'section'         => 'blog_page_settings',
            'label'           => __( 'Top Picks Label', 'wellness-coach-lite' ),
            'active_callback' => 'wellness_coach_lite_top_pick_ac',
        )
    );
    
    $wp_customize->selective_refresh->add_partial( 'top_pick_label', array(
        'selector'        => '.blog .feature-blog-section .section-header .sub-title',
        'render_callback' => 'wellness_coach_lite_get_top_pick_label',
    ) );

    $wp_customize->add_setting(
        'blog_top_pick',
        array(
            'default'           => 'popular',
            'sanitize_callback' => 'wellness_coach_lite_sanitize_select'
        )
    );

    $wp_customize->add_control(
        new Wellness_Coach_Lite_Select_Control(
            $wp_customize,
            'blog_top_pick',
            array(
                'label'           => __( 'Choose Top Picks', 'wellness-coach-lite' ),
                'description'     => __( 'Display top picks by:', 'wellness-coach-lite' ),
                'section'         => 'blog_page_settings',
                'choices'         => array(
                    'popular'       =>  __( 'Popular Posts', 'wellness-coach-lite' ),
                    'cat'           => __( 'Category', 'wellness-coach-lite' ),
                    'custom'        => __( 'Custom', 'wellness-coach-lite' )
                ),
                'active_callback' => 'wellness_coach_lite_top_pick_ac',

            )
        )
    );

    $wp_customize->add_setting(
        'top_picks_cat',
        array(
            'default'           => '',
            'sanitize_callback' => 'wellness_coach_lite_sanitize_select'
        )
    );

    $wp_customize->add_control(
        new Wellness_Coach_Lite_Select_Control(
            $wp_customize,
            'top_picks_cat',
            array(
                'label'           => __( 'Post Category', 'wellness-coach-lite' ),
                'description'     => __( 'Select a category to display posts', 'wellness-coach-lite' ),
                'section'         => 'blog_page_settings',
                'choices'         => wellness_coach_lite_get_categories(),
                'active_callback' => 'wellness_coach_lite_top_pick_ac'
            )
        )
    );

    $wp_customize->add_setting( 
        'top_picks_number', 
        array(
            'default'           => 4,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_number_absint'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Slider_Control( 
            $wp_customize,
            'top_picks_number',
            array(
                'section'     => 'blog_page_settings',
                'label'       => __( 'Number of Posts to be displayed', 'wellness-coach-lite' ),
                'choices'     => array(
                    'min'   => 4,
                    'max'   => 20,
                    'step'  => 4,
                ),
                'active_callback' => 'wellness_coach_lite_top_pick_ac',             
            )
        )
    );

    $wp_customize->add_setting( 
        new Wellness_Coach_Lite_Repeater_Setting( 
            $wp_customize, 
            'blog_custom', 
            array(
                'default'           => '',
                'sanitize_callback' => array( 'Wellness_Coach_Lite_Repeater_Setting', 'sanitize_repeater_setting' ),                             
            ) 
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Control_Repeater(
            $wp_customize,
            'blog_custom',
            array(
                'section' => 'blog_page_settings',              
                'label'   => __( 'Add Custom Top Picks', 'wellness-coach-lite' ),
                'fields'  => array(
                    'post' => array(
                        'type'         => 'select',
                        'label'        => __( 'Choose Post', 'wellness-coach-lite' ),
                        'description'  => __( 'Example: Homepage Sidebar', 'wellness-coach-lite' ),
                        'choices'      => wellness_coach_lite_get_posts( 'post', false, 10 ),
                    )
                ),
                'row_label' => array(
                    'type'  => 'field',
                    'value' => __( 'post', 'wellness-coach-lite' ),
                    'field' => 'name'
                ),
                'choices'   => array(
                    'limit' => 4
                ),
                'active_callback' => 'wellness_coach_lite_top_pick_ac',             
            )
        )
    );
    
    /** Show Popular Posts */
    $wp_customize->add_setting( 
        'ed_popular', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_popular',
            array(
                'section'     => 'blog_page_settings',
                'label'       => __( 'Show Popular Posts', 'wellness-coach-lite' ),
                'description' => __( 'Enable to show popular posts in blog layout one. Popular posts are based on comment count.', 'wellness-coach-lite' ),
            )
        )
    );  

    // /** Popular Posts section title */
    $wp_customize->add_setting(
        'popular_post_title',
        array(
            'default'           => __( 'Popular Articles', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'popular_post_title',
        array(
            'type'            => 'text',
            'section'         => 'blog_page_settings',
            'label'           => __( 'Popular Posts Section Title', 'wellness-coach-lite' ),
            'active_callback' => 'wellness_coach_lite_top_pick_ac'
        )
    );
    
    $wp_customize->selective_refresh->add_partial( 'popular_post_title', array(
        'selector' => '.popular-posts .sub-title',
        'render_callback' => 'wellness_coach_get_popular_title',
    ) );
    /** Blog Settings */

    /** Miscellaneous Settings */
    $wp_customize->add_section(
        'misc_settings',
        array(
            'title'    => __( 'Misc Settings', 'wellness-coach-lite' ),
            'priority' => 85,
            'panel'    => 'general_settings',
        )
    );

    /** Shop Page Description */
    $wp_customize->add_setting( 
        'ed_shop_archive_description', 
        array(
            'default'           => false,
            'sanitize_callback' => 'wellness_coach_lite_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Wellness_Coach_Lite_Toggle_Control( 
            $wp_customize,
            'ed_shop_archive_description',
            array(
                'section'         => 'misc_settings',
                'label'           => __( 'Shop Page Description', 'wellness-coach-lite' ),
                'description'     => __( 'Enable to show Shop Page Description.', 'wellness-coach-lite' ),
                'active_callback' => 'wellness_coach_lite_is_woocommerce_activated'
            )
        )
    );

    $wp_customize->add_setting(
        'error_404_image',
        array(
            'default'           => esc_url( get_template_directory_uri() . '/images/error404-img.jpg' ),
            'sanitize_callback' => 'wellness_coach_lite_sanitize_image',
        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize,
            'error_404_image',
            array(
                'label'           => __( '404 Image', 'wellness-coach-lite' ),
                'description'     => __( 'Choose the background image for 404 page.', 'wellness-coach-lite' ),
                'section'         => 'misc_settings',
            )
        )
    );

    $wp_customize->add_setting( 
        'error_404_button_label', 
        array(
            'default'           => __( 'Go To Blog', 'wellness-coach-lite' ),
            'sanitize_callback' => 'sanitize_text_field'
        ) 
    );
    
    $wp_customize->add_control(
        'error_404_button_label',
        array(
            'section'         => 'misc_settings',
            'label'           => __( 'Button Label for 404 Page', 'wellness-coach-lite' ),
            'type'            => 'text',
        )
    );
    /** Miscellaneous Settings Ends */
    
}
add_action( 'customize_register', 'wellness_coach_lite_customize_register_general' );