How to Create Additional Time Intervals in WPform

Discover how to Create Additional Time Intervals in WPform effortlessly. Enhance user experience by offering custom scheduling options. Follow our step-by-step guide to implement additional time intervals seamlessly.

Can the Date Time Field Time Picker be customized with additional time intervals? Time Picker intervals are set by default at 15 minutes, 30 minutes, and 1 hour.

You can easily create different intervals for your form by adding a small code snippet to your site. This tutorial will guide you through the necessary steps.

Adding the snippet for the additional time intervals

wpcode plugin
To add custom code

Adding additional time intervals to our form builder begins with adding the code snippet. You can do this by copying and pasting this code snippet.

We can help you add code snippets to your website.

 * Add additional time intervals for the Time field Interval dropdown
 * @link
function wpf_dev_datetime_time_intervals( $intervals ) {
     // Add time interval of 5 minutes
     $intervals[ '5' ] = esc_html__( '5 minutes', 'wpforms' );
     ksort( $intervals );
     return $intervals;
add_filter( 'wpforms_datetime_time_intervals' , 'wpf_dev_datetime_time_intervals', 10, 1 );

There will be a variable $intervals[ ‘5’ ] that contains the minutes. For example, if you wanted to create a 4-hour block, you would change 5 to 240.

Copy the code and put it to your code and code type will be PHP snipet

The new interval we just added will be displayed in the Intervals dropdown when we open the Advanced Options after we’ve added the Time field to our form.

Save the form after selecting the new option

To add custom code

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top