• I am using a plugin for an events calendar. My client will mostly be starting and stop all events at the same time so i am trying to set default values for the start and stop times. How can i do this? I believe this is the section i would add it to.

    $cr3ativconference_fields = array(
    	array(
                'label' => __('Date', 'cr3at_conf'),
                'desc' => __('Choose the date.', 'cr3at_conf'),
                'id' => 'cr3ativconfmeetingdate',
                'type' => 'date',
                'std' => ''
            ),
    	array(
            'label'    => __('Start Time', 'cr3at_conf'),
            'desc'    => __('Select the start time. 24-hour clock, 01:00-00:30', 'cr3at_conf'),
            'id'      => 'cr3ativ_confstarttime',
            'type' => 'text',
            'std' => ""
        ),
    	array(
            'label'    => __('End Time', 'cr3at_conf'),
            'desc'    => __('Select the end time. 24-hour clock, 01:00-00:30', 'cr3at_conf'),
            'id'      => 'cr3ativ_confendtime',
            'type' => 'text',
            'std' => ""
        ),
    	array(
                'label' => __('Location', 'cr3at_conf'),
                'desc' => __('Enter location.', 'cr3at_conf'),
                'id' => 'cr3ativ_conflocation',
                'type' => 'text',
    	     'value' => 'hawaii',
                'std' => ""
            ),
    	array(
                'label' => __('Speaker', 'cr3at_conf'),
                'desc' => __('Select the speakers.', 'cr3at_conf'),
                'id' => 'cr3ativ_confspeaker',
                'type' => 'post_chosen_speaker',
                'std' => ""
        ),
    	array(
                'label' => __('Highlight Style', 'cr3at_conf'),
                'desc' => __('Select this checkbox if you would like to have a highlight this session.', 'cr3at_conf'),
                'id' => 'cr3ativ_highlight',
                'type' => 'checkbox',
                'std' => ""
        )
    );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Since it looks like you’re using the CMB framework, you simply need to fill in the STD parameter. I would also recommend you upgrade to the latest , stable release of the CMB framework. The new release is superior in many ways to the original version.

    https://github.com/WebDevStudios/CMB2

    array(
        'label' => __('Date', 'cr3at_conf'),
        'desc' => __('Choose the date.', 'cr3at_conf'),
        'id' => 'cr3ativconfmeetingdate',
        'type' => 'date',
        'std' => '04/04/1989'
    ),

    it’s not letting me reply on my rudtek account. Not sure why. I tried what you suggested and i didn’t get any errors but it definitely didn’t load the defaults. any idea why? The framework came with a them i purchased, so i don’t know how to update it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘adding default values for custom field arrays’ is closed to new replies.