Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // show today's date in French on English website
- // code goes in functions.php of your child theme
- // usage: [french_date]
- add_shortcode('french_date', 'french_date');
- function french_date() {
- $site_locale = get_locale();
- setlocale(LC_ALL, 'fr_FR');
- $french_date = strftime('Le %A %e %B, %G'); // the date defaults to today
- $french_date = strtoupper($french_date);
- $french_date = utf8_encode($french_date);
- setlocale(LC_ALL, $site_locale); // restore locale to previous
- return $french_date;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement