Zentheme Pikadate
This module provides a Wordpress customizer Control based on the Pikaday Datepicker project. The module is available via composer so it can be added to a plugin or theme., (*1)
The Pikaday Datepicker has a pretty comprehensive range of config options, most of which are available to the Control, you can check them out on the Pikaday Project page on Github., (*2)
Install with composer
Download and install Composer by following the official instructions.
For usage, see the documentation., (*3)
Run the following in your terminal to install the module with Composer., (*4)
$ composer require zentheme/wpikaday
As this project uses PSR-4 autoloading you will need to use Composers autoloader., (*5)
Using the Control
Below is a simple example of how the control might be used in a plugin or theme. The example assumes that the vendor/autoload.php file has already been included., (*6)
use Zentheme\Customizer\Control\PikadayControl;
// Projects customizer configuration
add_action( 'customize_register', function( $wpCustomize ) {
// Add a section...
$wpCustomize->add_section( 'pikaday_section', [
'title' => 'Pikaday Section'
] );
// Then a setting...
$wpCustomize->add_setting( 'pikaday_setting', [
'default' => '',
'transport' => 'postMessage'
] );
// ...and finally add the Pikaday control
$wpCustomize->add_control(
new PikadayControl( $wpCustomize, 'pikaday_control', [
'label' => 'Pikaday Calendar',
'section' => 'pikaday_section',
'settings' => 'pikaday_setting',
'position' => 'bottom right', // position the datepicker
'format' => 'MMMM Do YYYY' // define the date format
// ... add any other valid Pikaday params here
] )
);
} );
Notes
Author
John Dundon, (*7)