<?php
/**
 *  Faced Single Page Option
 *
 * @since Faced 1.0.0
 *
 */
/*Single Page Options*/
$wp_customize->add_section( 'faced_single_page_section', array(
   'priority'       => 40,
   'capability'     => 'edit_theme_options',
   'theme_supports' => '',
   'title'          => __( 'Single Post Options', 'faced' ),
   'panel' 		 => 'faced_panel',
) );


/*Featured Image Option*/
$wp_customize->add_setting( 'faced_options[faced-single-page-featured-image]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-single-page-featured-image'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-single-page-featured-image]', array(
    'label'     => __( 'Enable Featured Image', 'faced' ),
    'description' => __('You can hide or show featured image on single page.', 'faced'),
    'section'   => 'faced_single_page_section',
    'settings'  => 'faced_options[faced-single-page-featured-image]',
    'type'      => 'checkbox',
    'priority'  => 15,
) );

/*Hide Tags in Single Page*/
$wp_customize->add_setting( 'faced_options[faced-single-page-tags]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-single-page-tags'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-single-page-tags]', array(
    'label'     => __( 'Enable Posts Tags', 'faced' ),
    'description' => __('You can enable the post tags in single page.', 'faced'),
    'section'   => 'faced_single_page_section',
    'settings'  => 'faced_options[faced-single-page-tags]',
    'type'      => 'checkbox',
    'priority'  => 15,
) );
/*Enable Underline in single post link place */
$wp_customize->add_setting( 'faced_options[faced-enable-underline-link]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-enable-underline-link'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-enable-underline-link]', array(
    'label'     => __( 'Enable Underline on Link', 'faced' ),
    'description' => __('If you enabled this, you will see the underline in the links. You can change it color from the general section of colors.', 'faced'),
    'section'   => 'faced_single_page_section',
    'settings'  => 'faced_options[faced-enable-underline-link]',
    'type'      => 'checkbox',
    'priority'  => 20,
) );

/*Related Post Options*/
$wp_customize->add_setting( 'faced_options[faced-single-page-related-posts]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-single-page-related-posts'],
    'sanitize_callback' => 'faced_sanitize_checkbox'
) );
$wp_customize->add_control( 'faced_options[faced-single-page-related-posts]', array(
    'label'     => __( 'Enable Related Posts', 'faced' ),
    'description' => __('3 Post from similar category will display at the end of the page.', 'faced'),
    'section'   => 'faced_single_page_section',
    'settings'  => 'faced_options[faced-single-page-related-posts]',
    'type'      => 'checkbox',
    'priority'  => 20,
) );
/*callback functions related posts*/
if ( !function_exists('faced_related_post_callback') ) :
    function faced_related_post_callback(){
        global $faced_theme_options;
        $faced_theme_options = faced_get_options_value();
        $related_posts = absint($faced_theme_options['faced-single-page-related-posts']);
        if( true == $related_posts ){
            return true;
        }
        else{
            return false;
        }
    }
endif;
/*Related Post Title*/
$wp_customize->add_setting( 'faced_options[faced-single-page-related-posts-title]', array(
    'capability'        => 'edit_theme_options',
    'transport' => 'refresh',
    'default'           => $default['faced-single-page-related-posts-title'],
    'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'faced_options[faced-single-page-related-posts-title]', array(
    'label'     => __( 'Related Posts Title', 'faced' ),
    'description' => __('Give the appropriate title for related posts', 'faced'),
    'section'   => 'faced_single_page_section',
    'settings'  => 'faced_options[faced-single-page-related-posts-title]',
    'type'      => 'text',
    'priority'  => 20,
    'active_callback'=>'faced_related_post_callback'
) );
