<?php
function bizwhoop_general_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';

    /* General Section */
    $wp_customize->add_panel( 'general_options', array(
        'priority' => 3,
        'capability' => 'edit_theme_options',
        'title' => __('General Settings', 'bizwhoop'),
    ) ); 
   
    //Scroller settings
    $wp_customize->add_section(
        'scroller',
        array(
            'priority'      => 1,
            'title'         => __('Scroller','bizwhoop'),
            'panel'         => 'general_options',
        )
    ); 

    //Enable and disable social icon
    $wp_customize->add_setting(
    'scroller_enable' ,
        array(
            'capability'     => 'edit_theme_options',
            'sanitize_callback' => 'bizwhoop_copyright_sanitize_checkbox',
        )   
    );
    $wp_customize->add_control(
    'scroller_enable',
        array(
            'label' => __('Hide / Show','bizwhoop'),
            'section' => 'scroller',
            'type' => 'checkbox',
        )
    ); 
}
add_action( 'customize_register', 'bizwhoop_general_setting' );
 
function bizwhoop_sanitize_select( $input, $setting ) {
    
    // Ensure input is a slug.
    $input = sanitize_key( $input );
    
    // Get list of choices from the control associated with the setting.
    $choices = $setting->manager->get_control( $setting->id )->choices;
    
    // If the input is a valid key, return it; otherwise, return the default.
    return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}