Wordpress Multilingual date
I am trying to set the date appear in the french way e.g "2 Mai" instead of "May 2"
here is my code:'
<?php // Get today's date in the right format
//$todaysDate = date('M d');
$todaysDate = date('m/d/Y H:i:s');
?>
<?php query_posts('showposts=5&category_name=events&meta_key=Date&meta_compare=>=&meta_value='.$todaysDate.'&orderby=meta_value=order=ASC'); ?>
<?php
if (have_posts()) : while (have_posts()) : the_post();
$eventMeta = get_post_meta($post->ID, 'Date', true);
$eventDate = strtotime($eventMeta);
$displayDate = date ('M d', $eventDate);?>
<ul>
<li>
<span class="date"><?php echo $displayDate ; ?></span>
<span><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></span>
</li>
<?php endwhile; else: ?>
<li><?php if ( (strtolower(ICL_LANGUAGE_CODE) == 'en') ) {echo("Sorry, no upcoming events for this month!");} ?>
<?php if ( (strtolower(ICL_LANGUAGE_CODE) == 'fr')) echo("Désolé, aucun év&开发者_运维问答eacute;nement à venir pour ce mois!") ?></li></ul>
<?php endif; ?>
How do I do it so that it switches the format depending on which language you are. To view the site click here
if(WPLANG == 'fr_FR'){
//It's French
} else {
// It's English
}
精彩评论