• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

テンプレートタグ/the modified time

提供: WordPress Codex 日本語版
< テンプレートタグ
2008年4月1日 (火) 03:33時点におけるBono (トーク | 投稿記録)による版 (ページ体裁・リンク調整、未翻訳)

移動先: 案内検索

このページ「テンプレートタグ/the modified time」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

This tag displays the time (and date) a post was last modified and is similar to the functionality of the_time(), which displays the time (and date) a post was created. This tag must be used within The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Options > General is used for the display format.

If the post or page is not yet modified, the modified time is the same as the creation time.

If you want to display both the modified time and the creation time, you may want to use an if statement (e.g. if (get_the_modified_time() != get_the_time())) to avoid showing the same time/date twice.

使い方

<?php the_modified_time('d'); ?>

用例

初期設定での使用

Displays the time (date) the post was last modified, using the Default date format setting (e.g. F j, Y) from Administration > Options > General.

<p>Last modified: <?php the_modified_time(); ?></p>
Last modified: December 2, 2006

Time in the 12-hour format (am/pm)

If a post was modified at 10:36pm, this example displays the time the post was last modified using the 12-hour format parameter string 'g:i a'.

<p>Time last modified: <?php the_modified_time('g:i a'); ?></p>
Time last modified: 10:36 pm

Time in the 24-hour format

If a post was modified at 10:36pm, this example displays the time the post was last modified using the 24-hour format parameter string 'G:i'.

<p>Time last modified: <?php the_modified_time('G:i'); ?></p>
Time last modified: 22:36

Date as Month Day, Year

Displays the last modified time and date in the date format 'F j, Y' (ex: December 2, 2006), which could be used to replace the tag the_modified_date().

<div>Last modified: <?php the_modified_time('F j, Y'); ?></div>
Last modified: December 2, 2006

Date and Time

Displays the date and time.

<p>Modified: <?php the_modified_time('F j, Y'); ?> at <?php the_modified_time('g:i a'); ?></p>
Modified: December 2, 2006 at 10:36 pm

パラメータ

(string) The format the time is to display in. Defaults to the date format configured in your WordPress options. See Formatting Date and Time.

変更履歴

  • 2.1 : 新規テンプレートタグ


日時に関連するタグ: 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_time最新版との差分