WordPress.org

Support

Support » Plugins and Hacks » Advanced Custom Fields » [Plugin: Advanced Custom Fields] Date Time Picker

[Plugin: Advanced Custom Fields] Date Time Picker

Viewing 7 replies - 1 through 7 (of 7 total)
  • I found this http://trentrichardson.com/examples/timepicker/ which should do the job but I’ve had no luck integrating it into /core/fields/date_picker/date_picker.php

    Any help would be great.

    Elliot has a register_field function now which is great for extending ACF:
    Creating and registering your own field

    I’ve used the timepicker extension above, and Elliot’s own datepicker field, to create a time field.

    Download these files, unzip and install in your theme directory.

    Add the following code to your functions.php file:
    register_field('xa_time_field', dirname(__FILE__) . '/custom-fields/timepicker/time_picker.php');

    (amend the appended URL as you wish, if necessary)

    You should now have a “Time” field type in Advanced Custom Fields!

    Around about line 158 in time_picker.php is where you can alter whether the JS displays datetimepicker or just timepicker.

    You might want to play around with data_date-format,data_time-format and the format of the date string to get the output you desire.

    Hope that helps.

    xanderashwell, very cool was just looking to solve this!

    I think the zip file on dropbox is corrupt, least from the 3 unzip programs I tried. Might try to write my own files but seemed to perfect that you just adding this 1 hour ago!

    Thank you

    Hi Geet,

    Try again, the zip file was corrupt at my end as well – I’ll also stick a copy up on github when I get a chance.

    Hi Xanderashwell,

    This is exactly what I’ve been looking for .. but I’m just having some trouble implementing it ….. I’ve copied the files over .. checked the url is correct … added the register field to my functions.php

    The ‘Time’ field becomes available, however it just doesn’t seem to function correctly. It doesn’t bring up a selector … just allows me to type in the custom field box.

    to try to figure out what I was doing wrong I edited the time_picker.php file and on line 158 I changed it to datepicker .. to test if that would work and it was fine (the date selector displayed as expected) … I just can’t get timepicker or datetimepicker working.

    eg.
    input.addClass(‘active’).datepicker({

    Any ideas? Many thanks!

    thanks @xanderashwell for posting your code. It works very well 🙂

    Hi daveleeone,

    Can I please ask what you changed line 158 to ?

    I’ve tried both:
    input.addClass(‘active’).timepicker({
    and
    input.addClass(‘active’).datetimepicker({

    but can’t get it to work … if I change it back to datepicker it works fine …

    Cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Advanced Custom Fields] Date Time Picker’ is closed to new replies.
Skip to toolbar