the_modified_time

Sponsored Link

the_modified_timeのタグは、記事の時間(と日付)を最終更新して表示します。記事の時間(と日付)は作成されて表示するthe_time()の機能と似ています。このタグはループ内で使用する必要があります。フォーマットパラメータが指定されていない場合、デフォルトの日付フォーマット(日付フォーマットと言うので注意してください。)は、管理画面>設定>一般から設定されている表示フォーマットを使用します。

Sponsored Link

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 > Settings > 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.

更新時間と作成時間の両方を表示したい場合は、同じ時刻/日付を2回表示する回避するためにステートメント(例. if (get_the_modified_time() != get_the_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.

値を取得するためにget_the_modified_timeを使用します。

Use get_the_modified_time to retrieve the value.

the_modified_timeのテンプレートタグ使用方法

<?php the_modified_time( $d ); ?> 

the_modified_timeのパラメーター

d

(string) (optional) 表示するための日付フォーマットです。デフォルトはWordPressのオプションで設定されている日付フォーマットです。日付と時刻のフォーマットを参照してください。

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

Default: F j, Y

デフォルトの使い方

管理画面>設定>一般から(e.g. F j, Y) に設定されているデフォルトの日付フォーマットを使用して、最終更新された記事の時間(日付)を表示します。

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

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

12時間形式(am/pm)で時間を表示する方法

記事が10:36pmに更新された場合、この例では’g:i a’の12時間形式のパラメータ文字列を使用して最終更新された記事の時間を表示します。

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

24時間形式で時間を表示する方法

記事が10:36pmに更新された場合、この例では’G:i’の24時間形式のパラメータ文字列を使用して最終更新された記事の時間を表示します。

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

年月日としてのデータを表示する方法

‘F j, Y’(例:2006年12月2日)の日付フォーマットで最終更新日時を表示します。the_modified_date()タグを置き換えるために使用する事が出来ます。

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

日付と時間を表示する方法

日付と時間を表示します。

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

関連テンプレートタグ

the_time, the_date, the_date_xml, the_modified_time, the_modified_date, the_modified_author, single_month_title, get_the_time, get_day_link, get_month_link, get_year_link, get_calendar

Sponsored Link