<?php
/**
* Slider options
*
* @package EliteWP WordPress Theme
* @copyright Copyright (C) 2025 ThemesDNA
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
* @author ThemesDNA <themesdna@gmail.com>
*/

function elitewp_slider_options($wp_customize) {

    $wp_customize->add_section( 'sc_elitewp_slider', array( 'title' => esc_html__( 'Slider', 'elitewp' ), 'panel' => 'elitewp_main_options_panel', 'priority' => 250 ) );

    $wp_customize->add_setting( 'elitewp_options[enable_slider]', array( 'default' => false, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'elitewp_sanitize_checkbox', ) );

    $wp_customize->add_control( 'elitewp_enable_slider_control', array( 'label' => esc_html__( 'Enable Slider', 'elitewp' ), 'section' => 'sc_elitewp_slider', 'settings' => 'elitewp_options[enable_slider]', 'type' => 'checkbox', ) );

    $wp_customize->add_setting( 'elitewp_options[slider_display]', array( 'default' => 'front-page', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'elitewp_sanitize_slider_display' ) );

    $wp_customize->add_control( 'elitewp_slider_display_control', array( 'label' => esc_html__( 'Slider Display Location', 'elitewp' ), 'description' => esc_html__('Select the slider display location.', 'elitewp'), 'section' => 'sc_elitewp_slider', 'settings' => 'elitewp_options[slider_display]', 'type' => 'select', 'choices' => array( 'front-page' => esc_html__('Home Page', 'elitewp'), 'front-page-static' => esc_html__('Static Home Page', 'elitewp') ) ) );

    $wp_customize->add_setting( 'elitewp_options[slider_length]', array( 'default' => 5, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'elitewp_sanitize_positive_integer' ) );

    $wp_customize->add_control( 'elitewp_slider_length_control', array( 'label' => esc_html__( 'Number of Slider Posts', 'elitewp' ), 'description' => esc_html__('Enter the number of posts you need to display in the slider area. Default is 5 posts.', 'elitewp'), 'section' => 'sc_elitewp_slider', 'settings' => 'elitewp_options[slider_length]', 'type' => 'text' ) );

    $wp_customize->add_setting( 'elitewp_options[slider_post_type]', array( 'default' => 'recent-posts', 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'elitewp_sanitize_slider_type' ) );

    $wp_customize->add_control( 'elitewp_slider_post_type_control', array( 'label' => esc_html__( 'Slider Posts Type', 'elitewp' ), 'description' => esc_html__('Select a post type to display in slider.', 'elitewp'), 'section' => 'sc_elitewp_slider', 'settings' => 'elitewp_options[slider_post_type]', 'type' => 'select', 'choices' => array( 'recent-posts' => esc_html__('Recent Posts', 'elitewp'), 'category-posts' => esc_html__('Category Posts', 'elitewp') ) ) );

    $wp_customize->add_setting( 'elitewp_options[slider_cat]', array( 'default' => 0, 'type' => 'option', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'absint' ) );

    $wp_customize->add_control( new EliteWP_Customize_Category_Control( $wp_customize, 'elitewp_slider_cat_control', array( 'label' => esc_html__( 'Slider Posts Category', 'elitewp' ), 'section' => 'sc_elitewp_slider', 'settings' => 'elitewp_options[slider_cat]', 'description' => esc_html__( 'Select a category if Posts Type option is Category Posts', 'elitewp' ) ) ) );

}