<?php
/**
 * Post Settings
 *
 * @package Feminine_Lifestyle_Blog
 */

function feminine_lifestyle_blog_customize_register_general_post_settings( $wp_customize ) {
    
    /** Single Post  Settings */
    $wp_customize->add_section(
        'single_post_settings',
        array(
            'title'    => __( 'Single Post', 'feminine-lifestyle-blog' ),
            'priority' => 50,
            'panel'    => 'general_settings',
        )
    );
    
    /** Enable Image Cropped Size In Single Posts */
    $wp_customize->add_setting( 
        'ed_crop_single', 
        array(
            'default'           => false,
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
        new Feminine_Lifestyle_Blog_Toggle_Control( 
            $wp_customize,
            'ed_crop_single',
            array(
                'section'     => 'single_post_settings',
                'label'       => __( 'Single Post Image Crop', 'feminine-lifestyle-blog' ),
                'description' => __( 'Enable to avoid automatic cropping of featured image in single post.', 'feminine-lifestyle-blog' ),
            )
        )
    );
         
    /** Author Section title */
    $wp_customize->add_setting(
        'author_title',
        array(
            'default'           => __( 'About Author', 'feminine-lifestyle-blog' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'author_title',
        array(
            'type'    => 'text',
            'section' => 'single_post_settings',
            'label'   => __( 'Author Section Title', 'feminine-lifestyle-blog' ),
        )
    );

    $wp_customize->selective_refresh->add_partial( 'author_title', array(
        'selector' => '.author-section h3',
        'render_callback' => 'feminine_lifestyle_blog_get_author_title',
    ) );

    /** Show Related Posts */
    $wp_customize->add_setting( 
        'ed_related', 
        array(
            'default'           => true,
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Feminine_Lifestyle_Blog_Toggle_Control( 
			$wp_customize,
			'ed_related',
			array(
				'section'     => 'single_post_settings',
				'label'	      => __( 'Show Related Posts', 'feminine-lifestyle-blog' ),
                'description' => __( 'Enable to show related posts in single page.', 'feminine-lifestyle-blog' ),
			)
		)
	);
    
    /** Related Posts section title */
    $wp_customize->add_setting(
        'related_post_title',
        array(
            'default'           => __( 'Recommended Articles', 'feminine-lifestyle-blog' ),
            'sanitize_callback' => 'sanitize_text_field',
            'transport'         => 'postMessage' 
        )
    );
    
    $wp_customize->add_control(
        'related_post_title',
        array(
            'type'            => 'text',
            'section'         => 'single_post_settings',
            'label'           => __( 'Related Posts Section Title', 'feminine-lifestyle-blog' ),
            'active_callback' => 'feminine_lifestyle_blog_post_page_ac'
        )
    );
    
    $wp_customize->selective_refresh->add_partial( 'related_post_title', array(
        'selector' => '.additional-post .title',
        'render_callback' => 'feminine_lifestyle_blog_get_related_title',
    ) );
     
    /** Comments */
    $wp_customize->add_setting(
        'ed_comments',
        array(
            'default'           => true,
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_checkbox',
        )
    );
    
    $wp_customize->add_control(
		new Feminine_Lifestyle_Blog_Toggle_Control( 
			$wp_customize,
			'ed_comments',
			array(
				'section'     => 'single_post_settings',
				'label'       => __( 'Show Comments', 'feminine-lifestyle-blog' ),
                'description' => __( 'Enable to show Comments in Single Post/Page.', 'feminine-lifestyle-blog' ),
			)
		)
	);
    
    /** Hide Category */
    $wp_customize->add_setting( 
        'ed_category', 
        array(
            'default'           => false,
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Feminine_Lifestyle_Blog_Toggle_Control( 
			$wp_customize,
			'ed_category',
			array(
				'section'     => 'single_post_settings',
				'label'	      => __( 'Hide Category', 'feminine-lifestyle-blog' )
			)
		)
	);
    
    /** Hide Post Author */
    $wp_customize->add_setting( 
        'ed_post_author', 
        array(
            'default'           => false,
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Feminine_Lifestyle_Blog_Toggle_Control( 
			$wp_customize,
			'ed_post_author',
			array(
				'section'     => 'single_post_settings',
				'label'	      => __( 'Hide Post Author', 'feminine-lifestyle-blog' )
			)
		)
	);
    
    /** Hide Posted Date */
    $wp_customize->add_setting( 
        'ed_post_date', 
        array(
            'default'           => false,
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_checkbox'
        ) 
    );
    
    $wp_customize->add_control(
		new Feminine_Lifestyle_Blog_Toggle_Control( 
			$wp_customize,
			'ed_post_date',
			array(
				'section'     => 'single_post_settings',
				'label'	      => __( 'Hide Posted Date', 'feminine-lifestyle-blog' )
			)
		)
	);
    
    /** Single Post Settings Ends */
    
}
add_action( 'customize_register', 'feminine_lifestyle_blog_customize_register_general_post_settings' );