Tagged: child theme, date format, datepicker, enfold, functions.php
-
AuthorPosts
-
June 5, 2015 at 2:21 pm #455088
I had a client who was confused with the default DD / MM / YY format of the date in the datepicker of the contact form element in Enfold.
I saw this thread that mentioned making a customization to class-form-generator.php:
The post said I could use that with a child theme. I have edited class-form-generator.php so that every reference of dd / mm / yy is now mm / dd / yy, and I uploaded that new file to childtheme/framework/php
But the date in the datepicker is still dd / mm / yy.
What else do I need to do?
Thanks in advance for your help. You guys are great!
June 5, 2015 at 2:27 pm #455089Hey AJDesignCo!
Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder'); function new_date_placeholder() { $placeholder = "MM / DD / YY"; return $placeholder; }
Regards,
YigitJune 5, 2015 at 2:38 pm #455091Thanks for the quick reply Yigit!
I added that, but it’s not quite working. This is a screenshot of functions.php in my child theme Editor:
Editor screenshotThis is the page with the contact form that includes a datepicker:
http://wc.ajdesignco.com/dinner-reservations/The initial display of the datepicker is correct: MM / DD / YY
But when the user uses the datepicker to select a date like June 12, 2015, the value that is displayed after clicking the date is 12 / 06 / 2015 (and to most North American users, that is December 6, 2015).
Is there something else I need to do? If what I’m asking isn’t feasible, please let me know and I’ll handle it with a plugin.
Thank you!
June 6, 2015 at 1:59 pm #455494Hi!
Please use this code instead:
add_filter( 'avf_datepicker_dateformat', function(){ return 'mm / dd / yy'; } ); add_filter( 'avf_datepicker_date_placeholder', function(){ return 'MM / DD / YY'; } );
Best regards,
IsmaelJune 8, 2015 at 7:28 pm #456303Thank you for the revision. It worked perfectly! And I have it added in the functions.php of my child theme, so future parent theme updates won’t disturb it. I appreciate the support!
June 9, 2015 at 7:01 am #456462 -
AuthorPosts
- The topic ‘MM / DD / YY order in Datepicker’ is closed to new replies.