-
AuthorPosts
-
June 20, 2018 at 12:07 pm #975231
Hi Kriesi Forum,
i would like to change the date format on a site. Atm i have dd/mm/yy and i would like to change it to mm/dd/YYY
I found this solution on your forum.
add_filter(‘avf_datepicker_dateformat’, ‘new_date_format’);
function new_date_format() {
$date_format = ” mm / dd / yy”;
return $date_format;
}
add_filter(‘avf_datepicker_date_placeholder’, ‘new_date_placeholder’);
function new_date_placeholder() {
$placeholder = “MM / DD / YY”;
return $placeholder;
}Now the question:
Can i do the change in the contact form on only one page, not generally on the site? For example on a page with the page id 709?Thank you
June 20, 2018 at 12:19 pm #975234Hey,
Please change the code to following one
add_filter('avf_datepicker_dateformat', 'new_date_format'); function new_date_format() { if(is_page(709){ $date_format = " mm / dd / yy"; } return $date_format; } add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder'); function new_date_placeholder() { if(is_page(709){ $placeholder = "MM / DD / YY"; } return $placeholder; }
Cheers!
YigitJune 20, 2018 at 12:34 pm #975247Thank you for your fast reply.
If i add this to child functions.php i get an error:
Parse error: syntax error, unexpected ‘;’ in /homepages/1/d344731888/htdocs/clickandbuilds/DrFleischmannDental/wp-content/themes/enfold child/functions.php on line 11
Thank you again
June 20, 2018 at 12:51 pm #975255Hi,
I cannot see any issue. Could you please post FTP and WP admin logins here privately so we can look into it?
Cheers!
YigitJune 20, 2018 at 1:08 pm #975270June 20, 2018 at 2:01 pm #975298Hi fxkreative,
I’ve added the code:
add_filter('avf_datepicker_dateformat', 'new_date_format'); function new_date_format() { if(is_page(709)) { $date_format = "mm / dd / yy"; } return $date_format; } add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder'); function new_date_placeholder() { if(is_page(709)) { $placeholder = "MM / DD / YY"; } return $placeholder; }
There was parenthesis missing. Please check.
Best regards,
VictoriaJune 20, 2018 at 4:26 pm #975372Thank you very much Victoria, works perfectly.
Your support is also one of the reason why i choose enfold over other themes.
A last request please. Now on the other contact page (Look private) the placeholder disappeared. It is the german contact form, can you please add a placeholder for the date again? (dd/mm/yy)
If tried it via functions, but failed.
Thank you again,
June 21, 2018 at 11:03 am #975745Hi fxkreative,
You can add another conditional statement that Victoria gave and just copy it and replace 709 with 23, the code should look like this:
add_filter('avf_datepicker_dateformat', 'new_date_format'); function new_date_format() { if(is_page(709)) { $date_format = "mm / dd / yy"; } if(is_page(23)) { $date_format = "mm / dd / yy"; } return $date_format; } add_filter('avf_datepicker_date_placeholder', 'new_date_placeholder'); function new_date_placeholder() { if(is_page(709)) { $placeholder = "MM / DD / YY"; } if(is_page(23)) { $placeholder = "MM / DD / YY"; } return $placeholder; }
Hope it helps.
Best regards,
NikkoJune 21, 2018 at 1:37 pm #975787Thank you Yigit, Victoria and Nikko for the great support.
It works perfectly, you can close the thread.
Best regards,
Sergej- This reply was modified 6 years, 5 months ago by fxkreative.
June 21, 2018 at 2:15 pm #975795Hi,
You are welcome!
Please take a moment to review our theme and show your support https://themeforest.net/downloads
Best regards,
Yigit -
AuthorPosts
- The topic ‘Change date format to mm/dd/yy’ is closed to new replies.