LoginSignup
0
0

More than 5 years have passed since last update.

[WordPress] 公開日時と更新日時を表示しつつ予約投稿で公開日よりも更新日時が過去になるのを避ける

Posted at

答えは _s のソースコードにあるので、おおよそ公式ディレクトリ掲載のテーマは対応してますが、ポイントは以下。

答えは以下。
https://github.com/Automattic/_s/blob/master/inc/template-tags.php#L10-L36

_s では 公開日時と更新日時が 一致しない 場合に両方表示するようにしていますが、予約投稿で公開日時よりも更新日時が過去になるのが気になる場合は if の所を変えればOK。

if ( get_the_time( 'U' ) < get_the_modified_time( 'U' ) ) {

余談
DATE_W3C という定数とはなんぞやと思った人は以下
http://php.net/manual/ja/class.datetime.php

PHP 5.2.0 とPHP7で使えるDateTime クラスの定数

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0