WordPress

WordPress の英語のテーマを日本語化してみる(その2) - 日付のフォーマットを修正する。

2009年9月6日

記事の下の日付のフォーマットが英語スタイル「9月6th, 2009」になっているので、これを変更。

image

index.php を読むと

<?php the_content('続きを読む &raquo;'); ?>
<div class="post-info">
<?php the_time('F jS, Y') ?> in
<?php the_category(', '); ?>
<?php the_tags('| tags: ', ', ', ''); ?> |
<?php comments_popup_link('<strong>コメント(0)</strong>', '<strong>コメント(1)</strong>', '<strong>コメント(%)</strong>'); ?>
</div>

”続きを読む” の次post-info クラスの所ぽいので、その次の the_time(‘F jS, Y’) ぽい。
the_time の使い方は、

the_time(format)

で、 format の部分は、PHP の日付の文法が使える。 2009年07月10日の様なフォーマットにするには、以下の様にする。

the_time(Y年m月d日)

・Y  4桁の西暦

・m  2桁の月(数字)

・ d  2桁の日付

出力結果は以下の通りになる。
image

-WordPress

Copyright© エンジニアの何でもメモ帳 , 2024 All Rights Reserved.