WP Manifestindependent plugin directory
manifest / content / cmb2-multidates-picker

CMB2 Multidates Picker

Creates a CMB2 field that enables a multiple date calendar

by Origgami · github.com/origgami/cmb2-multidates-picker · website

8stars
3forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/origgami/cmb2-multidates-picker/archive/refs/heads/master.zip

Readme

Cmb2 MultidatesPicker

Creates a CMB2 field that enables a multiple date calendar. It uses a plugin called MultiDatesPicker v1.6.3 for jQuery UI

Usage

Create your cmb2 metabox like you are used to, but on your field, use the attribute type => 'multidates'

$prefix = '_mdpt_';
$cmb_demo = new_cmb2_box(array(
    'id'             => $prefix . 'metabox',
    'title'          => __('Test Metabox', 'cmb2'),
    'object_types'   => array('page',), // Post type
));
$cmb_demo->add_field(array(
    'name'   => __('Test Text', 'cmb2'),
    'desc'   => __('field description (optional)', 'cmb2'),
    'id'     => $prefix . 'dates',
    'type'   => 'multidates',

    //Any value from http://multidatespickr.sourceforge.net or http://api.jqueryui.com/datepicker/
    'multidates_params' => array(
        //'maxPicks'     => 3,
        //'dateFormat'   => "y-m-d",
    ),
));

Options

As it uses MultiDatesPicker v1.6.3 for jQuery UI, you can use all of the parameters from both MultiDatesPicker and also JqueryUI Datepicker itself. These are some interesting parameters i could check, but like i said, there are a bunch of them

'multidates_params' => array(
    //'maxPicks'     => 3,
    //'dateFormat'   => "y-m-d", //Default is "yy-mm-dd"
    //pickableRange: 7,
)

Screenshots

This is the new field you get using this plugin

Image

Read the full README on GitHub →