开发者

Wordpress Multilingual date

开发者 https://www.devze.com 2023-01-01 13:15 出处:网络
I am trying to set the date appear in the french way e.g \"2 Mai\" instead of \"May 2\" here is my code:\'

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&eacute;sol&eacute;, aucun &eacute;v&开发者_运维问答eacute;nement &agrave; 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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消