万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
関数リファレンス/get comment date
現在のコメント、または指定したコメントが投稿された日付を取得します。PHP の日付文法が使用できます。
使い方
<?php get_comment_date( $d, $comment_ID ); ?>
パラメータ
- $d
- (文字列) (オプション) 日付の出力形式。空文字列の場合、デフォルトの get_option( 'date_format' ) になる(管理画面の 設定 » 一般設定 » 日付のフォーマット・時刻のフォーマット で設定した形式)。
- 初期値: 空文字列
- $comment_ID
- (整数) (オプション) 日付を表示するコメントの ID
- 初期値:
0
(現在のコメント)
- 初期値:
戻り値
- (文字列)
- フォーマットされたコメントの投稿日。
用例
これは "Saturday, November 6th, 2010" のような形式の日付を出力します。
<?php $d = "l, F jS, Y"; $comment_date = get_comment_date( $d, $comment_ID ); echo $comment_date; ?>
参考
- 'get_comment_date' /en フィルターフックを呼び出します。パラメータは、フォーマット済みの日付、
$d
、コメントのオブジェクトです。 - コメントのオブジェクトを取得するために get_comment() /en を使用します。
変更履歴
- 1.5.0 : 新規導入。
ソースファイル
get_comment_date() は wp-includes/comment-template.php
にあります。
関連資料
コメント関数: cancel_comment_reply_link(), comment_author(), comment_author_email(), comment_author_email_link(), comment_author_IP(), comment_author_link(), comment_author_rss(), comment_author_url(), comment_author_url_link(), comment_class(), comment_date(), comment_excerpt(), comment_form_title(), comment_form(), comment_ID(), comment_id_fields() / en, comment_reply_link(), comment_text(), comment_text_rss(), comment_time(), comment_type(), comments_link, comments_number(), comments_open(), comments_popup_link(), comments_popup_script(), comments_rss_link(), get_avatar(), next_comments_link(), paginate_comments_links(), permalink_comments_rss(), previous_comments_link(), wp_list_comments()
最新英語版: WordPress Codex » Function Reference/get_comment_date (最新版との差分)