Toggle Field Join KC discussion

This field creates a boolean field which allows you set value to yes/no as mobile app.

KingComposer field toggle

Map Usage:

array(
	'name' => 'field_id',
	'label' => 'Field Label',
	'type' => 'toggle',  // USAGE RADIO TYPE
	'value' => 'DEFAULT-CONTENT', // remove this if you do not need a default content 
	'description' => 'Field Description',
)

Example:

Register a new shortcode with filed type: toggle

Toggle field is off with 'no' value on default. To make toggle field is on, just set value is 'yes'

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' => 'show_title',
                        'label' => 'Allow show title',
                        'type' => 'toggle',
                        'description' => 'Display number of post'
                    ),
                    //2nd field
                )
            ),

            // 2nd shortcode element

        ) // End Arrays
    );

} // end my_wp_init()
       
?>

Read more