mustardBees / cmb-field-select2

Select2 field type for Custom Metaboxes and Fields for WordPress
93 stars 46 forks source link

pw_multiselect Is not working! #20

Closed asifsaho closed 8 years ago

asifsaho commented 9 years ago

Here is my code

add_action('cmb2_init', function () {

// Start with an underscore to hide fields from custom fields list
$prefix = 'presskit-';

/**
 * Initiate the metabox
 */
$cmb = new_cmb2_box(array(
    'id' => 'presskit-details',
    'title' => __('Press Kit Details', 'pressroom'),
    'object_types' => array('presskit'), // Post type
    'context' => 'normal',
    'priority' => 'high',
    'show_names' => true, // Show field names on the left
    // 'cmb_styles' => false, // false to disable the CMB stylesheet
    //'closed'     => true, // Keep the metabox closed by default
));

$cmb->add_field(array(
    'name' => 'Description',
    'desc' => 'Add few words about it',
    'id' => $prefix . 'description',
    'type' => 'text',
));

$cmb->add_field(array(
    'name' => 'Description',
    'desc' => 'Add few words about it',
    'id' => $prefix . 'description',
    'type' => 'text',
));

$cmb->add_field(array(
        'name' => 'Ingredients',
        'id' => $prefix . 'ingredients',
        'desc' => 'Select ingredients. Drag to reorder.',
        'type' => 'pw_multiselect',
        'options' => array(
            'flour' => 'Flour',
            'salt' => 'Salt',
            'eggs' => 'Eggs',
            'milk' => 'Milk',
            'butter' => 'Butter',
        ),
    )
);

});

mustardBees commented 8 years ago

@asifsaho Can you try with the latest release and let me know if you have any further trouble.