Skip to content

iamntz/wp-caldera-forms-time-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

Caldera Forms is missing a time picker, providing instead only a date picker. This plugin can replace the existing datepicker and will add the ability to use a time picker as well. I'm using the awesome plugin flatpickr for the frontend and shamelessly stealed most of the backend config from the Caldera's built in date picker.

How to use it

By default, this is set to append a new field type:

However, you can override the built in field by adding the following line in you functions.php file:

add_filter('caldera_forms_replace_default_datepicker', '__return_true');

Other hooks

For now, there are two hooks available, which will allow you to add/edit existing datepicker styles or localization, both of them expecting an associative array (keys are used as values).

add_filter('caldera_forms_datepicker_languages', function($lang) {
  $lang = [
    'http://your-path-to-localization-file/en.js' => 'English',
    'http://your-path-to-localization-file/fr.js' => 'French'
  ];

  // OR

  $lang[http://your-path-to-localization-file/fr.js] = 'French';

  return $lang;
});

Same goes for the styles, but you'll gonna use caldera_forms_datepicker_styles filter instead.

A small note about using styles

Please note that changing a datepicker theme will affect ALL other flatpickr in the page. Yes, even if they are in a different form or even are not built with Caldera Forms!

Todo

  • Add JS hooks for each field;

Contribute

You are more than welcome to submit any pull requests if you find bugs or anything to improve!

Support me!

You can get hosting, donate or buy me a gift.

About

Date/time picker for Caldera Forms

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published