Here is a quick method to localize with ease the jQuery UI datepicker fields on your site. The 1st thing you need to do is to access that page, and from there click on the language you want to apply to your datepicker fields. Let’s use French for this post. When you click on the jquery.ui.datepicker-fr.js link, here is what you see:
To add the localization to your WordPress install, we’ll hook this code to the wp_footer filter (the code below goes within the functions.php file in your theme folder):
And boom, all your datepicker fields will be localized into French! Well, of course you can improve that code, but the basis is here!
Just one last thing: don’t forget to use a PHP “if” statement to avoid loading that code when not needed. Otherwise it would break your javascript functions.
Leave a Reply
You must be logged in to post a comment.