- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
テンプレートタグ/the modified date
このページ「テンプレートタグ/the modified date」は 情報が古くなっている可能性があります。最新版(英語)も合わせてご覧ください。最新に更新してくださる協力者を求めています。
タグ一覧: テンプレートタグ | インクルードタグ | 条件分岐タグ | その他の関数 | Code Reference
使い方: テンプレートタグ入門 | パラメータの渡し方 | 初心者の方へ | その他のテーマ関連資料
説明
このタグは記事を最後に更新した日付 (または時間) を表示します。the_modified_time() と似ていますが、このタグでは最後に更新した日付または時間を表示します。このタグはループ内で使用しなければなりません。パラメータが指定されない場合、管理パネル > 設定 > 一般設定 にある日付フォーマットの設定が適用されます。
記事やページを更新していない場合、更新日は作成日と同じになります。
使い方
<?php the_modified_date('d'); ?>
Parameters
- $d
- (string) (optional) The format the date is to display in. Defaults to the date format configured in your WordPress settings. See Formatting Date and Time.
- 初期値: date format specified in Administration > Settings > General
- $before
- (string) (optional) Output before the date.
- 初期値: なし
- $after
- (string) (optional) Output after the date.
- 初期値: なし
- $echo
- (boolean) (optional) Default is display. Whether to echo the date or return it.
- 初期値: true
- true (default)
- false
用例
初期設定での使用
管理パネル > 設定 > 一般設定 の日付フォーマットの設定 (例: F j, Y) を使って最終更新日を表示します。
<p>最終更新日: <?php the_modified_date(); ?></p>
「月 日, 年」の順で表示
「F j, Y」という日付フォーマットで最終更新日を表示します (例: 12 月 2, 2006)。
<p>最終更新日: <?php the_modified_date('F j, Y'); ?></p>
日付と時刻
日付と時刻を表示します。
<p>更新日時: <?php the_modified_date('F j, Y'); ?> at <?php the_modified_date('g:i a'); ?></p>
パラメータ
- d
- (文字列) 表示する日付フォーマット。デフォルトでは管理パネルで設定した値が適用されます。Formatting Date and Time を参照してください。
変更履歴
関連
日時に関連するタグ:
get_calendar(),
get_day_link(),
get_month_link(),
get_the_date(),
get_the_time(),
get_year_link(),
single_month_title(),
the_date(),
the_date_xml(),
the_modified_date(),
get_the_modified_date(),
the_modified_time(),
get_the_modified_time(),
the_time()
最新英語版: WordPress Codex » Template Tags/the_modified_date (最新版との差分)