Localizing jQuery UI Datepicker fields

by

in

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.

5 responses to “Localizing jQuery UI Datepicker fields”

  1. yoursrazi

    Can the categories be ordered by as they appear in WordPress.

    1. i don’t see the point with the post content?

  2. Hi Remi !
    This method sounds magic ! I’m looking for it for hours now so when can say you save my life…until this. I paste this code at the end of my functions.php file but when I reload the page, this one stays blank. Nothing appears. I was thinking about the PHP “if” statement you talk about but I don’t know how to write it. Thanks for your help Remi !

  3. Forget my message Remi, it works ! (une question de retour à la ligne ;-) Thanks a lot !

  4. DominicLindner

    Hey Dude,
    first at all, I´m happy to get in touch with your code. I rly would like to spend u a coffee :p but its not working at all.

    I would like to use the german version of the datepicker.

    1. The date is not shwon like 01.06.2015 its more like Jun1Jun5Jun2015Jun. It does not look great. There must be a mistake.

    2. Do you have the code to put it into php if statement ? I tried for hours… i cant fix it. Because the code destroys my java scripts like Visual Composer and all the menus.

    Would be pretty great if you help me with it !

    Kind Regards,
    Dominic Lindner

Leave a Reply