Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 73026

Issue after rendering a field using cmb2_get_field

$
0
0

Replies: 2

After rendering a field using cmb2_get_field (date picker in this case)
I think the related js for the date picker isn’t added and when I am clicking on the field, then date picker isn’t appearing.

Here’s the code I’m using –

$cmb_box_sync_post_form = new_cmb2_box(array(
            'id' => 'ccb_event_sync_to_post_metabox',
            'hookup' => false,
            'save_fields' => false,
            'cmb_styles' => false,
        ));
        $cmb_box_sync_post_form->add_field(array(
            'name' => __('Fetch Events Start Date', 'liquid-outreach'),
            'desc' => __('',
                'liquid-outreach'),
            'id' => 'start_date', // No prefix needed.
            'type' => 'text_date',
            'default' => !empty($_POST['start_date']) ? $_POST['start_date'] : '',
            'attributes' => [
                'required' => 'required'
            ]
        ));
        $cmb_box_sync_post_form->add_field(array(
            'name' => __('Fetch Events End Date', 'liquid-outreach'),
            'desc' => __('',
                'liquid-outreach'),
            'id' => 'end_date', // No prefix needed.
            'type' => 'text_date',
            'default' => !empty($_POST['end_date']) ? $_POST['end_date'] : '',
            'attributes' => [
                'required' => 'required'
            ]
        ));
$cmb_field_start_date = cmb2_get_field('ccb_event_sync_to_post_metabox', 'start_date');
                $cmb_field_start_date->render_field();

Viewing all articles
Browse latest Browse all 73026

Latest Images

Trending Articles



Latest Images