<?php
/**
 * Template Index.php
 * @package MatrixAddons
 * @subpackage trainifyframework
 * @since 1.0.0
 */
$wp_customize->add_section(
    'template_index_options', 
    array(
        'title' => esc_html__('Blog/Home Page', 'trainify'),
        'panel' => 'site_template_options',
        'priority' => 50,
    )
);

/**
 * Enable Breadcrumbs
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'trainify_framework_enable_breadcrumbs_index', array(
        'sanitize_callback' => 'esc_attr',
        'default'           => 'disable',
    )
);
$wp_customize->add_control(
    new TrainifyFramework_Customize_Switch_Control(
        $wp_customize, 
        'trainify_framework_enable_breadcrumbs_index', 
        array(
            'label' => esc_html__('Enable Breadcrumbs?', 'trainify'),
            'section' => 'template_index_options',
            'priority' => 10,
            'type'=>'switch',
            'choices'=> array(
                'enable'=> esc_html__('Enable', 'trainify'),
                'disable'=> esc_html__('Disable', 'trainify'),
            ),
            'description'=> esc_html__('You can enable breadcrumbs to show before blog page.', 'trainify'),
        )
    )
);

/**
 * Sidebar Layouts
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'trainify_framework_default_index_sidebar',
    array(
        'default'           => 'right_sidebar',
        'sanitize_callback' => 'sanitize_key',
    )
);
$wp_customize->add_control( 
    new TrainifyFramework_Customize_Imageoptions_Control(
        $wp_customize,
        'trainify_framework_default_index_sidebar',
        array(
            'label'    => esc_html__( 'Sidebar Layout', 'trainify' ),
            'description' => esc_html__( 'Choose sidebar from available layouts', 'trainify' ),
            'section'  => 'template_index_options',
            'choices'  => array(
                'left_sidebar' => array(
                    'label' => esc_html__( 'Left Sidebar', 'trainify' ),
                    'url'   => '%s/inc/trainifyframework/assets/img/sidebars/left-sidebar.png'
                ),
                'right_sidebar' => array(
                    'label' => esc_html__( 'Right Sidebar', 'trainify' ),
                    'url'   => '%s/inc/trainifyframework/assets/img/sidebars/right-sidebar.png'
                ),
                'no_sidebar' => array(
                    'label' => esc_html__( 'No Sidebar', 'trainify' ),
                    'url'   => '%s/inc/trainifyframework/assets/img/sidebars/no-sidebar.png'
                ),
                'no_sidebar_center' => array(
                    'label' => esc_html__( 'No Sidebar Center', 'trainify' ),
                    'url'   => '%s/inc/trainifyframework/assets/img/sidebars/no-sidebar-center.png'
                ),
                'both_sidebar' => array(
                    'label' => esc_html__( 'Both Sidebar', 'trainify' ),
                    'url'   => '%s/inc/trainifyframework/assets/img/sidebars/both-sidebar.png'
                )
            ),
            'priority' => 20
        )
    )
);

/**
 * Read More Text Index.php 
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'trainify_framework_readmore_text_index', array(
        'sanitize_callback' => 'esc_attr',
        'default'           => esc_html__('Read More...', 'trainify'),
    )
);
$wp_customize->add_control(
    'trainify_framework_readmore_text_index', 
    array(
        'type'=>'text',
        'priority' => 30,
        'label' => esc_html__('Readmore Text', 'trainify'),
        'section' => 'template_index_options',
        'description'=> esc_html__('If you can show featured image on blog page check on show button.', 'trainify'),
    )
);

/**
 * Short Description Length 
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'trainify_framework_excerpt_length_index', array(
        'sanitize_callback' => 'absint',
        'default'           => 400,
    )
);
$wp_customize->add_control(
    'trainify_framework_excerpt_length_index', 
    array(
        'type'=>'number',
        'priority' => 40,
        'label' => esc_html__('Description Length', 'trainify'),
        'section' => 'template_index_options',
        'description'=> esc_html__('Please choose no of character to display description length in blog page.', 'trainify'),
    )
);

/**
 * Enable Post Date
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'trainify_framework_enable_date_index', array(
        'sanitize_callback' => 'esc_attr',
        'default'           => 'show',
    )
);
$wp_customize->add_control(
    new TrainifyFramework_Customize_Switch_Control(
        $wp_customize, 
        'trainify_framework_enable_date_index', 
        array(
            'label' => esc_html__('Show date on posts?', 'trainify'),
            'section' => 'template_index_options',
            'priority' => 50,
            'type'=>'switch',
            'choices'=> array(
                'show'=> esc_html__('Show', 'trainify'),
                'hide'=> esc_html__('Hide', 'trainify'),
            ),
            'description'=> esc_html__('If you can show post date on blog page please check show button.', 'trainify'),
        )
    )
);

/**
 * Enable Author Name
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
    'trainify_framework_enable_authorname_index', array(
        'sanitize_callback' => 'esc_attr',
        'default'           => 'show',
    )
);
$wp_customize->add_control(
    new TrainifyFramework_Customize_Switch_Control(
        $wp_customize, 
        'trainify_framework_enable_authorname_index', 
        array(
            'label' => esc_html__('Show author name on posts?', 'trainify'),
            'section' => 'template_index_options',
            'priority' => 60,
            'type'=>'switch',
            'choices'=> array(
                'show'=> esc_html__('Show', 'trainify'),
                'hide'=> esc_html__('Hide', 'trainify'),
            ),
            'description'=> esc_html__('If you can show author name on blog page please check show button.', 'trainify'),
        )
    )
);
