Tagged: datetime
- This topic has 3 replies, 3 voices, and was last updated 5 years, 1 month ago by
Stephen.
Viewing 3 reply threads
-
AuthorPosts
-
-
January 28, 2016 at 1:40 pm #5797
zhangqiMemberPiklist is very useful for me, but I dont know how to use datetime in piklist? for exsample:2016-01-29 01:38
thank you! -
January 31, 2016 at 7:39 pm #5809
jivedigMemberI couldn’t get it to work either. I ended up using a text field with a wrapper class (attribute) on the field, and used https://github.com/xdan/datetimepicker with a target of that field element. Working well so far.
Attachments:
You must be logged in to view attached files. -
December 14, 2016 at 7:06 am #7651
StephenParticipantAnyone have any code examples for how to implement this? Thanks in advance
-
December 14, 2016 at 8:31 am #7652
StephenParticipantNevermind I figured it out. Here is the code if it helps someone:
In my setup plugin:
// DATETIMEPICKER ENQUEUE add_filter('piklist_assets', 'my_assets'); function my_assets($assets) { array_push($assets['scripts'], array( 'handle' => 'datetimepicker' ,'src' => get_template_directory_uri() . '/js/jquery.datetimepicker.full.js' ,'ver' => '2.5.4' ,'deps' => 'jquery' ,'enqueue' => true ,'in_footer' => true ,'admin' => true ,'front' => false )); array_push($assets['scripts'], array( 'handle' => 'dtpickermine' ,'src' => get_template_directory_uri() . '/js/dtpickermine.js' //my jQuery(document).ready code... ,'ver' => '1.0' ,'deps' => 'jquery' ,'enqueue' => true ,'in_footer' => true ,'admin' => true ,'front' => false )); array_push($assets['styles'], array( 'handle' => 'datetimepickerclasses' ,'src' => get_template_directory_uri() . '/js/jquery.datetimepicker.css' ,'ver' => '1.2' ,'enqueue' => true ,'in_footer' => true ,'admin' => true ,'media' => 'screen, projection' )); return $assets; }And then in my meta field definition:
piklist('field', array( 'type' => 'text' ,'field' => 'ae_dtpicker' ,'label' => __('my date time', 'direct-action') ,'attributes' => array( 'class' => 'dtpicker' ) ));
-
-
AuthorPosts
Viewing 3 reply threads
- The topic ‘how to use datetime in piklist?’ is closed to new replies.