PHP code example of mustartt / searchable-dropdown-control

1. Go to this page and download the library: Download mustartt/searchable-dropdown-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/ */

    

mustartt / searchable-dropdown-control example snippets


if ( class_exists( 'WP_Customize_Control' ) ) {
    

$wp_customize->add_setting(
    'font',
    array(
        'default'           => 'Roboto',
        'sanitize_callback' => function ( $value ) {
            return $value;
        }
    )
);

$wp_customize->add_control(
    new Customizer_Searchable_Dropdown_Control(
        $wp_customize,
        'font',
        array(
            'label'    => 'Select Font',
            'section'  => 'fonts',
            'settings' => 'font',
            'options'  => array(
                'Roboto', 'Arial', 'Helvetica', 'Calibri'
            )
        )
    )
);