I am working on a Wordpress theme using a template to manage sports team, matches, players, etc.
I settled my local wordpress time in French. In the blog part, no problem the post are displaying date in French.
But there is a all part with custom post types managed by a plugin. The dates displayed by this plugins remains in English.
By checking the code, I can see the date part formatting is managed here :
function team_get_match_start($match_id, $format = 'j F Y / G:i') {
$date_start = get_post_meta($match_id, '_date_start', true);
if (!$date_start || !strtotime($date_start)) {
return '';
}
$timezone_string = get_option('timezone_string');
$gmt_offset = get_option('gmt_offset');
if ($timezone_string) {
$tz = $timezone_string;
} else if ($gmt_offset > 0) {
$tz = date('+Hi', abs($gmt_offset) * 3600);
} else if ($gmt_offset < 0) {
$tz = date('-Hi', abs($gmt_offset) * 3600);
} else {
$tz = 'UTC';
}
$datetime = date_create( $date_start, new DateTimeZone($tz));
return $datetime->format( $format );
So, this displays me 28 JULY 2017 / 13:00. I would like it to be in french.
I did many unsuccessful tries with strftime(). I am reading about date_i18n() wordpress function, but I am not sure about what to do with it.
Anyone as an idea that could help me ?
Cheers guys