Creating the Difference

How to change default Event Dates & Times

Posted on: 15-12-2019 Last modified: 03-07-2021
Categories: HTML, PHP Tags:

When creating a new event in Events Manager, the working and the lay-out of the “When” meta box always bothered me.

I found it cluttered. The Time Picker always started at 00:00 and showed steps of 15 minutes.
My events always start at :00 or :30, so I have no need for :15 and :45. And… I like my interface clean and tidy.

Since the default times are hard-coded to midnight, it’s not easy to change those, right? WRONG! ;-)

Step 1: Create a new file on your server.

Create a new file on your live server in:
/wp-content/themes/your-theme/plugins/events-manager/forms/event/when.php.

Step 2: Copy, Paste & Edit.

Copy the section of code below and paste it in the new file.
You may want to edit lines 5,6,12, 24, 25 and 26 to your personal needs.

Save the new file when you’re done.

[php] start()->format($hours_format) === ’00:00′ ? ’09:00′ : $EM_Event->start()->format($hours_format); $end_time = $EM_Event->end()->format($hours_format) === ’00:00′ ? ’17:00′ : $EM_Event->end()->format($hours_format); ?> event_all_day) ? ‘checked=”checked”‘ : null; echo ‘
‘; echo ‘
‘; echo ‘

‘; echo ‘‘ . __(‘Dates’) . ‘
‘; echo __( ‘From ‘, ‘events-manager’); echo ‘‘; echo ‘‘; echo ‘‘; echo ‘

‘; echo ‘‘ . ucfirst( __(‘times’,’events-manager’) ) . ‘
‘; echo __( ‘From ‘, ‘events-manager’); echo ‘‘; echo ‘ ‘. __(‘to’,’events-manager’) .’ ‘; echo ‘‘; echo ‘

‘; echo ‘

‘. __(‘All day’,’events-manager’) .’

‘; if( get_option(‘dbem_timezone_enabled’) ) { echo ‘

‘; echo ‘‘; echo ‘‘; echo ‘

‘; } echo ‘‘. esc_html__(‘This event spans every day between the beginning and end date, with start/end times applying to each day.’, ‘events-manager’) .’‘; echo ‘
‘; if( false && get_option(‘dbem_recurrence_enabled’) && $EM_Event->is_recurrence() ) { echo ‘Step 3: Log-in to WordPress

Log-in to WordPress and navigate to “Add New Event” to see the magic unfold before your eyes…
That’s all there is to it!


⇐ Previous