PHP code example of helgatheviking / kia-customizer-range-control

1. Go to this page and download the library: Download helgatheviking/kia-customizer-range-control library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

helgatheviking / kia-customizer-range-control example snippets



/**
 * Add range slider to Customizer.
 *
 * @param  obj     $wp_customize
 */
function kia_customizer( $wp_customize ) {
    // Include the class
       $wp_customize->add_setting(
        'my_setting',
        array(
            'default'              => 3,
            'type'                 => 'option',
            'capability'           => 'edit_themes',
            'transport'            => 'postMessage',	
            'sanitize_callback'    => 'absint',
            'sanitize_js_callback' => 'absint',
        )
    );

    $wp_customize->add_control(
        new KIA_Customizer_Range_Control(
            $wp_customize,
            'my_control',
            array(
                'type'        => 'kia-range',
                'label'       => __( 'Number of columns', 'your-textomain' ),
                'description' => __( 'How many items should be shown per row?', 'your-textdomain' ),
                'section'  => 'my_section',
	            'settings' => 'my_setting',	
                'input_attrs' => array(
                    'min'  => 1,
                    'max'  => 6,
                    'step' => 1,
                ),
            )
        )
    );

}
add_action( 'customize_register', 'kia_customizer' );