投稿日時を「〜日前、〜時間前」に変える方法

0
929

記事一覧で投稿した日付は(〜年〜月〜日)と表示されます。

投稿日時を、日付ではなく「〜日前(〜時間前)」と表示させる方法をご紹介いたします。
方法はとてもカンタンです。
functions.phpに下記のコードを挿入するだけです。
function time_ago( $type = ‘post’ ) {
$d = ‘comment’ == $type ? ‘get_comment_time’ : ‘get_post_time’;
return human_time_diff($d(‘U’), current_time(‘timestamp’)) . “” . __(‘前’);
}

必ず結果が出るブログ運営テクニック100

コメントを書く

必須項目をご入力ください
必須項目をご入力ください