Select Field Join KC discussion

The Select field creates a drop-down select input.

Notice: This field requires the 'options' parameter.

KingComposer field select

Map Usage:

array(
	'name' => 'field_id',
	'label' => 'Field Label',

	'type' => 'select',  // USAGE SELECT TYPE
	'options' => array(  // THIS FIELD REQUIRED THE PARAM OPTIONS
		'value_1' => 'The Text 1',
		'value_2' => 'The Text 2',
		'value_3' => 'The Text 3',
	)

	'value' => 'DEFAULT-CONTENT', // remove this if you do not need a default content 
	'description' => 'Field Description',
)

Example:

Register a new shortcode with filed type: select

add_map(
	    
        array(
           
            // 1st shortcode element
            'my_shortcode' => array(
                'name' => 'My Shortcode',
                'description' => 'This is my shortcode',
                'icon' => 'my-class-icon',
                'category' => 'Content',
                'params' => array(
                    //1st field
                    array(
                        'name' => 'parallax',
                        'label' => 'Parallax',
                        'type' => 'select',
                        'option' => array(
                             'none' => 'None',
                             'bg_img' => 'Use Background Image',
                             'upload_img' => 'Upload New Image',
                        ),
                        'value' => 'bg_img', // Set default is value_2, remove this if you dont need to set default
                        'description' => 'My description',
                        'admin_label' => true, // Show in admin_view, you can remove this if you dont want preview value
                    ),
                    //2nd field
                )
            ),

            // 2nd shortcode element

        ) // End Arrays
    );

} // end my_wp_init()
       
?>

Read more