- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
テンプレートタグ/get the date
提供: WordPress Codex 日本語版
< テンプレートタグ
get_the_date テンプレートタグは、現在の投稿(または指定された投稿)が書かれた日付を取得します。the_date()
とは異なり、このタグは常に日付を返します。'get_the_date'
/en フィルターで出力を変更します。
使い方
<?php $pfx_date = get_the_date( $format, $post_id ); ?>
パラメータ
- $post
- (整数) (オプション) 日付を取得したい投稿の ID。省略すると現在の投稿から取得される。
- 初期値: null(現在の投稿)
戻り値
(文字列) フォーマットされた日付の文字列
フィルター
-
apply_filters
を使って'get_the_date'
を呼び出します。パラメータは、返される文字列と$format
です。
更新履歴
- 3.0.0 : 新規導入
用例
デフォルトの使い方
<span class="entry-date"><?php echo get_the_date(); ?></span>
ソースファイル
get_the_date()
は wp-includes/general-template.php
にあります。
関連項目
日時に関連するタグ:
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 » Function Reference/get_the_date (最新版との差分)