Adding Datetimepicker JQuery API at Settings form

DateTimePicker is a JQuery plugin which is adding the datepicker or timepicker dropdown to your forms. In this article I am sharing how you will add this API with BB’s settings form’s text field. See the step by step procedure at below:

Download the DateTimePicker API

At first download the master zip file from Github. Extract the file and you will get the build folder. Move the jquery.datetimepicker.min.css file in your active theme’s css folder. Same way you will move the jquery.datetimepicker.full.min.js file in js folder.

Now create a new JS file jquery.datetimepicker.init.js and save into js folder. Here is the complete code of this JS file

 

Enqueue the CSS and JS files

WordPress have an action wp_enqueue_scripts. With it I am loading the style and javascript file. Open the functions.php file of your active theme and add the following PHP snippets

Adding DateTimePicker Field

As a example I selected the Content Slider module. So I wrote this kind of PHP snippet in functions.php file

Date time picker field

It will create the date field. You will enter the mouse into date input field and date time picker box will appear. So you can easily select the date. At front end you can fetch the submitted date value with $settings->datetime code.

Leave a Comment





Newsletter

Get free weekly PRO Beaver Builder Tutorials

shares