WordPress で the_date() という関数を使っていると、同じ日に複数の記事がある場合でも、次のように日付が一回した表示されません(最新バージョンの挙動は未確認です)。 という質問を頂きましたので、本エントリーでは、次のように記事ごとに日付を出力するように変更する方法を紹介します。 方法は簡単で、the_date() を the_time() に変更します。 以下は当サイトで配布しているWordPress テーマの変更箇所です。 変更前 …前略… <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="entry" id="post<?php the_ID(); ?>"> <?php the_date('Y.m.d', '<p class="date">', '</p>') ?>
![WordPress の the_date を変更して記事ごとに日付を表示する](https://cdn-ak-scissors.b.st-hatena.com/image/square/1556ab6d980f254e1ee39b8c2fcb798aaf6e19e0/height=288;version=1;width=512/https%3A%2F%2Fwww.koikikukan.com%2Fimages%2Fcat3_80.jpg)