簡體   English   中英

如何為法語發布拉法語的日期/時間?

[英]How to pull date/time in french format for wordpress post?

我正在處理一個wordpress帖子,在其中我希望以frech格式顯示日期/時間,如下所示:

ENGLISH

By FJ
Published April 9, 2019 at 4:05 p.m.
Last updated April 9, 2019 at 4:14 p.m.


FRENCH

Un texte de FJ
Publié le 9 avril 2019 à 16 h 05
Mis à jour le 9 avril 2019 à 16 h 14

我已經使用以下代碼為wordpress發布拉英語/法語的日期/時間:

<strong><?php if (ICL_LANGUAGE_CODE == 'en') { ?>
        By
    <?php } else { ?>
        Un texte de
    <?php } ?><?php the_author(); ?> </strong><br>
<strong><?php if (ICL_LANGUAGE_CODE == 'en') { ?>
        Published <?php the_time('F j, Y'); ?>
    <?php } else { ?>
        Publié le <?php the_time('j F, Y'); ?>
    <?php } ?> <?php if (ICL_LANGUAGE_CODE == 'en') { ?>
        at  <?php the_time('g:i a'); ?>
    <?php } else { ?>
        à   <?php the_time('g:i a'); ?>
    <?php } ?>  </strong><br>
<strong><?php if (ICL_LANGUAGE_CODE == 'en') { ?>
        Last updated <?php the_modified_time('F j, Y');
    } else { ?>
        Mis à jour le <?php the_modified_time('j F, Y');
    } ?><?php if (ICL_LANGUAGE_CODE == 'en') { ?>
        at <?php the_modified_time('g:i a');
    } else { ?>
        à  <?php the_modified_time('g:i a');
    } ?>  </strong>

上面的代碼顯示以下o / p 英語很好,但法語似乎無效。

By FJ
Published April 9, 2019 at 4:05 p.m.
Last updated April 9, 2019 at 4:14 p.m.

Un texte de FJ
Publié le avril 9, 2019 à 4:05
Mis à jour le avril 9, 2019 à 5:14

您可以嘗試在“ ifs”中為法語格式聲明不同的日期格式,如下所示

<strong><?php if(ICL_LANGUAGE_CODE=='en'){ ?>
By
<?php }else{ ?>
Un texte de
<?php  } ?><?php the_author(); ?> </strong><br>
<strong><?php if(ICL_LANGUAGE_CODE=='en'){ ?>
Published <?php the_time('F j, Y'); ?>
<?php }else{ ?>
Publié le <?php the_time('j F, Y'); ?>
<?php  }  ?> <?php if(ICL_LANGUAGE_CODE=='en'){ ?>
at
<?php }else{ ?>
à
<?php  }  ?> <?php the_time('g:i a'); ?> </strong><br>
<strong><?php if(ICL_LANGUAGE_CODE=='en'){ ?>
Last updated <?php the_modified_time('F j, Y'); ?>
<?php }else{ ?>
Mis à jour le <?php the_modified_time('j F, Y'); ?>
<?php  } ?><?php if(ICL_LANGUAGE_CODE=='en'){ ?>
at
<?php }else{ ?>
à
<?php  }  ?> <?php the_modified_time('g:i a'); ?> </strong>


暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM