Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9217019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:32:48+00:00 2026-06-18T02:32:48+00:00

Working on a WordPress theme that I had to convert the locale to french.

  • 0

Working on a WordPress theme that I had to convert the locale to french.

    $data_event     = get_post_meta($post->ID, 'event_date_interval', true);
    $time           = strtotime($data_event);
    $pretty_date_yy = date('Y', $time);
    setlocale (LC_ALL, "fr_FR");
    $translate_fr  = strftime("%h", strtotime($data_event));
    $pretty_date_M = htmlentities($translate_fr);
    $pretty_date_d  = date('d', $time);

This works fine, it shows everything as it should (For example, right now we are in February so it shows FÉVR)

However my problem lies in that I want it to show FÉV. and not FÉVR. Is it possible to change this abbreviation?

EDIT: Solution was to create an array and set the specific names I wanted. It was not encoding properly utf8_encode was added. Thanks Phex!

    $data_event     = get_post_meta($post->ID, 'event_date_interval', true);
    $time           = strtotime($data_event);
    setlocale (LC_ALL, "fr_FR");
    $pretty_date_yy = date('Y', $time);
    $pretty_date_d  = date('d', $time);
    $id = intval(strftime("%m", strtotime($data_event))) - 1;
    $abr_map = array(
      'Jan',
      'Fév',
      'Mar',
      'Avr',
      'Mai',
      'Juin',
      'Juil',
      'Aout',
      'Sept',
      'Oct',
      'Nov',
      'Déc'
    );
    $translate_fr = htmlentities(utf8_decode($abr_map[$id]));
    $pretty_date_M = $translate_fr;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:32:49+00:00Added an answer on June 18, 2026 at 2:32 am

    One way to do it would be to use PHPs substr function as follows:

    $translate_fr  = substr(strftime("%h", strtotime($data_event)), 0, 3);
    

    Edit:
    In case not all months should be abbreviated to three characters, it would be possible to use an associative array as a map:

    $abr_map = array(
      'JANV' => 'Jan',
      'FÉVR' => 'Fév',
      'MARS' => 'Mar',
      'AVRI' => 'Avr',
      'MAI'  => 'Mai',
      'JUIN' => 'Juin',
      'JUIL' => 'Juil',
      'AOUT' => 'Aout',
      'SEPT' => 'Sept',
      'OCTO' => 'Oct',
      'NOVE' => 'Nov',
      'DÉCE' => 'Déc'
    );
    

    Alternatively using intval and strftimes %m formatter to provide an integer “key” for an indexed array:

    $id = intval(strftime("%m", strtotime($data_event))) - 1;
    
    $abr_map = array(
      'Jan',
      'Fév',
      'Mar',
      'Avr',
      'Mai',
      'Juin',
      'Juil',
      'Aout',
      'Sept',
      'Oct',
      'Nov',
      'Déc'
    );
    

    To use the map within the function, you would then use

    $translate_fr = htmlentities(utf8_decode($abr_map[$id]));
    

    or alternatively using htmlentities built in encoder:

    $translate_fr = htmlentities($abr_map[$id], ENT_COMPAT, 'UTF-8');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a wordpress theme that uses dropdowns for part of the site
I'm working on a wordpress theme, and I have a rather unique structure that
So, I'm working on a WordPress theme that uses a custom taxonomy to create
I'm working on a wordpress theme-switching plugin that relies on the on a php
I am working on a WordPress theme, with a theme options page that contains
I'm working with a wordpress theme that uses a php file as a stylesheet.
I'm using a Wordpress Theme that doesn't have the blog / latest post displaying
I have a working website that i am translating over to a WordPress theme.
I'm working on a Wordpress theme that has a Jquery animated contact form in
I have just installed a custom WordPress theme (this is my first time working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.