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 786303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:01:13+00:00 2026-05-14T21:01:13+00:00

I am a newbie in PHP & wordpress. I wanted to know how to

  • 0

I am a newbie in PHP & wordpress. I wanted to know how to make this codde renders the date formating in french (e.g. 5 Fev) when your on the french side but in english format in English (e.g. Jan 5)

Here is my code:

<?php
if (strtolower(ICL_LANGUAGE_CODE) == 'en') {$sidePosts = get_posts('cat=3,4,5,19&posts_per_page=5&order=DESC&orderby=date');}
if (strtolower(ICL_LANGUAGE_CODE) == 'fr') {$sidePosts = get_posts('cat=9,10,11,17&posts_per_page=5&order=DESC&orderby=date');}
foreach($sidePosts as $sidePosts) {
    $array = (array) $sidePosts;
    print("<li>");
    print("<span class='date'>".get_the_time('M j', $array[ID])."</span>");
    print("<a href='".get_permalink($array[ID])."' title='".$array[post_title]."'>".$array[post_title]."</a>");
    print("</li>");
}
?>
  • 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-05-14T21:01:14+00:00Added an answer on May 14, 2026 at 9:01 pm

    You could replace this:

    print("<span class='date'>".get_the_time('M j', $array[ID])."</span>");
    

    with this:

    if (strtolower(ICL_LANGUAGE_CODE) == 'en') 
    {
        print("<span class='date'>".get_the_time('M j', $array[ID])."</span>");
    
    }
    else {
        print("<span class='date'>".get_the_time('j M', $array[ID])."</span>");
    }
    

    In the long run you may want to look at using a plugin to do this since you will likely have to redo this change after updating wordpress.

    You may also want to read this: http://codex.wordpress.org/Formatting_Date_and_Time and
    http://gettingeek.com/internationalize-localize-a-wordpress-theme-guide-for-dummies-part-1-introduction-70.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still learning the ropes with PHP & MySQL and I know I'm doing
I'm a total newbie and want to start with php. I know some javascript
RewriteEngine On RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)$ index.php?p=$1&l=$2 RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/$ index.php?p=$1&l=$2 this works fine if I do
I'm trying to solve Project Euler #9, which is http://projecteuler.net/index.php?section=problems&id=9 . I've looked through
I want to validate a form to make sure a user writes in a
I'm a newbie who is creating a lightweight photo showcase site written on the
I am a newbie to mod_rewrite and I was wondering if there is any
Im really really a newbie in regexp and I can’t figure out how to
On a users profile, there is a comment box that enables other users to

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.