Giter VIP home page Giter VIP logo

cmb2-date-range-field's Introduction

WDS CMB2 Date Range Field

Description

Adds a date range field to CMB2

CMB 2 Date Range Field Demo

Installation

Manual Installation

  1. Upload the entire /wds-cmb2-date-range-field directory to the /wp-content/plugins/ directory.
  2. Activate WDS CMB2 Date Range Field through the 'Plugins' menu in WordPress.

Frequently Asked Questions

How do I use the field?

Use the field type of date_range when initializing your CMB2 Field.

	$prefix = '_yourprefix_';
	$cmb_demo = new_cmb2_box( array(
 		'id'           => $prefix . 'metabox',
 		'title'        => __( 'Test Metabox', 'cmb2' ),
 		'object_types' => array( 'post', ), // Post type
 		'context'      => 'normal',
 		'priority'     => 'high',
 		'show_names'   => true,
 
 	) );
 
 	$cmb_demo->add_field( array(
 		'name'       => __( 'Test Date Range', 'cmb2' ),
 		'desc'       => __( 'field description (optional)', 'cmb2' ),
 		'id'         => $prefix . 'date_range',
 		'type'       => 'date_range',
 	) );

Screenshots

Changelog

0.1.2

  • Fix year being stored as "Y" instead of the actual year. Fixes #7
  • Make it work without JS. Also, add spinner until daterange picker loads.
  • Update styling to work with CMB2's new picker styles.

0.1.1

  • The included jQuery UI css was causing major conflicts. This now leans heavily on CMB2 datepicker UI styling.
  • Updated to use CMB2 APIs so that expected functionality will not break.
  • Moved all JS to separate file and handle initiating datepicker with data attributes on the field inputs.

0.1.0

  • First release

cmb2-date-range-field's People

Contributors

1bigidea avatar bradp avatar dustyf avatar jrfoell avatar jtsternberg avatar rasmustaarnby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmb2-date-range-field's Issues

Lowercase composer package name

From composer:

webdevstudios/CMB2-Date-Range-Field is invalid, it should not contain uppercase characters. Please use webdevstudios/cmb2-date-range-field instead. Make sure you fix this as Composer 2.0 will error.

Date range field is not repeatable

I'm working with this right now and I'm happy with it, but I noticed that if a date range field is part of a repeatable field group, only the field in the first group will open the date picker when clicked on. This makes it a bit impossible to have multiple related date ranges on a field, which I'm hoping to use in a current project!

Idea to customize Basename/URL/Path

public function __construct() {
        if ( ! defined( 'WDS_CMB2_Date_Range_BASENAME' ) ) {
            define( 'WDS_CMB2_Date_Range_BASENAME', plugin_basename( __FILE__ ));
        }
        if ( ! defined( 'PW_GALLERY_URL' ) ) {
            define( 'WDS_CMB2_Date_Range_URL', plugin_dir_url( __FILE__ ));
        }
        if ( ! defined( 'WDS_CMB2_Date_Range_DIR' ) ) {
            define( 'WDS_CMB2_Date_Range_DIR', plugin_dir_path( __FILE__ ));
        }

        $this->basename = WDS_CMB2_Date_Range_BASENAME;
        $this->url      = WDS_CMB2_Date_Range_URL;
        $this->path     = WDS_CMB2_Date_Range_DIR;
    }

This is an idea using constants to customize the attributes above, I can customize my structure of theme

Layout is broken in 2.2.2

Layout seems to be broken using CMB2 2.2.2 and above. It seems to related to missing css class or something like that. I haven't found it yet though.

2 2 1
2 2 2

Undefined index: desc - error in log

PHP Notice: Undefined index: desc in /home/sbeasley/Sites/stt/web/app/plugins/CMB2-Date-Range-Field/wds-cmb2-date-range-field.php on line 136

i am getting this error, any ideas what it could be?

thanks

Year is stored as "Y" instead of the actual year

Not sure if I'm doing something wrong but when defining the field as:

$cmb->add_field( array(
'name'       => __( 'Test Date Range', 'cmb2' ),
'desc'       => __( 'field description (optional)', 'cmb2' ),
'id'         => $this->field_prefix . 'date_range',
'type'       => 'date_range',
) );

This is what gets saved to the database:

a:2:{s:5:"start";s:6:"9/28/Y";s:3:"end";s:7:"10/31/Y";}

i.e. the year is saved as "Y" instead of the actual year

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.