Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

WordPress - Show date in French on English website

lorro Aug 3rd, 2015 (edited) 184 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.   // show today's date in French on English website
  2.   // code goes in functions.php of your child theme
  3.   // usage: [french_date]
  4.   add_shortcode('french_date', 'french_date');
  5.   function french_date() {
  6.     $site_locale = get_locale();
  7.     setlocale(LC_ALL, 'fr_FR');
  8.     $french_date = strftime('Le %A %e %B, %G'); // the date defaults to today
  9.     $french_date = strtoupper($french_date);
  10.     $french_date = utf8_encode($french_date);
  11.     setlocale(LC_ALL, $site_locale); // restore locale to previous
  12.     return $french_date;
  13.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top