zentheme/wpikaday

A Pikaday calendar Control for Wordpress customizer.

1.0.1 2016-12-06 06:40 UTC

This package is not auto-updated.

Last update: 2024-09-29 01:19:58 UTC


README

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.

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.

Install with composer

Download and install Composer by following the official instructions. For usage, see the documentation.

Run the following in your terminal to install the module with Composer.

$ composer require zentheme/wpikaday

As this project uses PSR-4 autoloading you will need to use Composers autoloader.

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.

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