- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「テンプレートタグ/the modified date」の版間の差分
細 (→パラメータ) |
細 (最新版のマージ) |
||
4行目: | 4行目: | ||
== 説明 == | == 説明 == | ||
− | このタグは記事を最後に更新した日付 (または時間) を表示します。[[テンプレートタグ/the_modified_time|the_modified_time()]] と似ていますが、このタグでは最後に更新した日付または時間を表示します。このタグは[[The Loop|ループ]]内で使用しなければなりません。パラメータが指定されない場合、[[ | + | このタグは記事を最後に更新した日付 (または時間) を表示します。[[テンプレートタグ/the_modified_time|the_modified_time()]] と似ていますが、このタグでは最後に更新した日付または時間を表示します。このタグは[[The Loop|ループ]]内で使用しなければなりません。パラメータが指定されない場合、[[管理画面]] > [[管理画面#General|設定]] > [[管理画面/一般設定|一般設定]] にある'''日付フォーマット'''の設定が適用されます。 |
記事やページを更新していない場合、更新日は作成日と同じになります。 | 記事やページを更新していない場合、更新日は作成日と同じになります。 | ||
+ | |||
+ | 値を取得するには、 [[関数リファレンス/get the modified date|get_the_modified_date()]] をお使いください。 | ||
<div id="Usage"> | <div id="Usage"> | ||
12行目: | 14行目: | ||
</div> | </div> | ||
− | <?php the_modified_date( | + | <?php the_modified_date( $d, $before, $after, $echo ); ?> |
<div id="Parameters"> | <div id="Parameters"> | ||
18行目: | 20行目: | ||
</div> | </div> | ||
− | {{Parameter|$d|文字列| | + | {{Parameter|$d|文字列|表示する日付フォーマット。デフォルトでは管理画面で設定した値が適用されます。[[日付と時刻の書式]] を参照してください。|オプション|日付フォーマットを指定 [[管理画面]] > [[管理画面#Settings|設定]] > [[Administration_Panels#.E4.B8.80.E8.88.AC.E8.A8.AD.E5.AE.9A|一般設定]]}} |
{{Parameter|$before|文字列|日付の前に出力|オプション}} | {{Parameter|$before|文字列|日付の前に出力|オプション}} | ||
{{Parameter|$after|文字列|日付の後ろに出力|オプション}} | {{Parameter|$after|文字列|日付の後ろに出力|オプション}} | ||
35行目: | 37行目: | ||
</div> | </div> | ||
− | [[ | + | [[管理画面]] > [[管理画面#General|設定]] > [[管理画面/一般設定|一般設定]] の'''日付フォーマット'''の設定 (例: F j, Y) を使って最終更新日を表示します。 |
<pre><p>最終更新日: <?php the_modified_date(); ?></p></pre> | <pre><p>最終更新日: <?php the_modified_date(); ?></p></pre> | ||
49行目: | 51行目: | ||
<pre><p>最終更新日: <?php the_modified_date('F j, Y'); ?></p></pre> | <pre><p>最終更新日: <?php the_modified_date('F j, Y'); ?></p></pre> | ||
− | <div class="example">最終更新日: 12 月 2, 2006</div> | + | <div class="example">最終更新日: 12 月 2, 2006</div><br/> |
<div id="Date_and_Time"> | <div id="Date_and_Time"> | ||
59行目: | 61行目: | ||
<pre><p>更新日時: <?php the_modified_date('F j, Y'); ?> at <?php the_modified_date('g:i a'); ?></p></pre> | <pre><p>更新日時: <?php the_modified_date('F j, Y'); ?> at <?php the_modified_date('g:i a'); ?></p></pre> | ||
− | <div class="example">更新日時: 12 月 2, 2006 at 10:36 pm</div> | + | <div class="example">更新日時: 12 月 2, 2006 at 10:36 pm</div><br/> |
+ | |||
+ | === Date with <sup>superscript</sup> or <sub style="font-size:0.8em;">subscript</sub> number suffixes === | ||
+ | |||
+ | Displays the date with a superscript or subscript ''st'', ''nd'', ''rd'' or ''th'' after the day. Because characters from the alphabet are used to represent the date format types, each of the HTML tag characters need to be escaped using a back slash. Superscript HTML tag is <tt><sup></tt> and subscript is <tt><sub></tt>. | ||
+ | |||
+ | <p>Modified: <?php the_modified_date('j\<\s\u\p\>S\<\/\s\u\p\> M Y'); ?></p> | ||
+ | |||
+ | <div style="border:1px solid blue; width:50%; padding:10px">Modified: 2<sup>nd</sup> Dec 2006</div><br/> | ||
75行目: | 85行目: | ||
{{Tag Footer}} | {{Tag Footer}} | ||
− | {{原文|Template Tags/the_modified_date| | + | {{原文|Template Tags/the_modified_date|116265}}<!--14:46, 27 April 2012 Donutz 版 --> |
{{DEFAULTSORT:The_modified_date}} | {{DEFAULTSORT:The_modified_date}} |
2015年8月11日 (火) 08:37時点における版
このページ「テンプレートタグ/the modified date」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
タグ一覧: テンプレートタグ | インクルードタグ | 条件分岐タグ | その他の関数 | Code Reference
使い方: テンプレートタグ入門 | パラメータの渡し方 | 初心者の方へ | その他のテーマ関連資料
目次
説明
このタグは記事を最後に更新した日付 (または時間) を表示します。the_modified_time() と似ていますが、このタグでは最後に更新した日付または時間を表示します。このタグはループ内で使用しなければなりません。パラメータが指定されない場合、管理画面 > 設定 > 一般設定 にある日付フォーマットの設定が適用されます。
記事やページを更新していない場合、更新日は作成日と同じになります。
値を取得するには、 get_the_modified_date() をお使いください。
使い方
<?php the_modified_date( $d, $before, $after, $echo ); ?>
パラメータ
- $d
- (文字列) (オプション) 表示する日付フォーマット。デフォルトでは管理画面で設定した値が適用されます。日付と時刻の書式 を参照してください。
- $before
- (文字列) (オプション) 日付の前に出力
- 初期値: なし
- $after
- (文字列) (オプション) 日付の後ろに出力
- 初期値: なし
- $echo
- (真または偽) (オプション) デフォルトは表示をします。日付をエコーまたはそれを返すかどうか。
- 初期値: true
- true (デフォルト)
- false
用例
初期設定での使用
管理画面 > 設定 > 一般設定 の日付フォーマットの設定 (例: F j, Y) を使って最終更新日を表示します。
<p>最終更新日: <?php the_modified_date(); ?></p>
「月 日, 年」の順で表示
「F j, Y」という日付フォーマットで最終更新日を表示します (例: 12 月 2, 2006)。
<p>最終更新日: <?php the_modified_date('F j, Y'); ?></p>
日付と時刻
日付と時刻を表示します。
<p>更新日時: <?php the_modified_date('F j, Y'); ?> at <?php the_modified_date('g:i a'); ?></p>
Date with superscript or subscript number suffixes
Displays the date with a superscript or subscript st, nd, rd or th after the day. Because characters from the alphabet are used to represent the date format types, each of the HTML tag characters need to be escaped using a back slash. Superscript HTML tag is <sup> and subscript is <sub>.
<p>Modified: <?php the_modified_date('j\<\s\u\p\>S\<\/\s\u\p\> M Y'); ?></p>
変更履歴
関連
日時に関連するタグ:
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_date (最新版との差分)