mardi 1 août 2017

How to select the options condition?

    $cmb->add_field( array(
    'name'             => 'Select Video or Image',
    'desc'             => 'Select an option',
    'id'               => 'the_wiki_id_one',
    'type'             => 'select',
    'show_option_none' => true,
    'default'          => 'custom',
    'options'          => array(
        'standard' => __( 'Option One', 'cmb2' ),
        'custom'   => __( 'Option Two', 'cmb2' ),
        'none'     => __( 'Option Three', 'cmb2' ),
    ),
) );

Above is the code. Now suppose If I have chosen Option two, and I want to execute a logic Like this →

If (Option 2 selected) {
 <?php Then execute some PHP code ?>
}

Option 2 selected → layman Language. How can we do this in terms of programming one?

Above is a code from CMB2 Wordpress Plugin

Aucun commentaire:

Enregistrer un commentaire