当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
「テンプレートタグ/the time」の版間の差分
提供: WordPress Codex 日本語版
< テンプレートタグ
細 (1 版) |
|||
1行目: | 1行目: | ||
− | + | {{Languages| | |
− | + | {{en|Template Tags/the_time}} | |
− | + | {{ja|テンプレートタグ/the_time}} | |
− | + | }} | |
− | + | ||
− | + | ||
− | + | ||
− | [[ | + | == Description == |
+ | |||
+ | Displays the time of the current post. To return the time of a post, use [[Template Tags/get_the time|get_the_time()]]. This tag must be used within [[The Loop]]. | ||
+ | |||
+ | == Usage == | ||
+ | |||
+ | %%% <?php the_time( $d ); ?> %%% | ||
+ | |||
+ | == Parameters == | ||
+ | |||
+ | {{Parameter|$d|string|The format the time is to display in. Defaults to the time format configured in your WordPress options. See [[Formatting Date and Time]].|optional}} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === Default Usage === | ||
+ | |||
+ | Displays the time using your WordPress defaults. | ||
+ | |||
+ | <p>Time posted: <?php the_time(); ?></p> | ||
+ | |||
+ | === Time as AM/PM VS. 24H format=== | ||
+ | |||
+ | Displays the time using the format parameter string <tt>'g:i a'</tt> (ex: 10:36 pm). | ||
+ | |||
+ | <p>Time posted: <?php the_time('g:i a'); ?></p> | ||
+ | |||
+ | Displays the time using the 24 hours format parameter string <tt>'G:i'</tt> (ex: 17:52). | ||
+ | |||
+ | <p>Time posted: <?php the_time('G:i'); ?></p> | ||
+ | |||
+ | === Date as Month Day, Year === | ||
+ | |||
+ | Displays the time in the date format <tt>'F j, Y'</tt> (ex: December 2, 2004), which could be used to replace the tag [[Template Tags/the date|the_date()]]. | ||
+ | |||
+ | <div><?php the_time('F j, Y'); ?></div> | ||
+ | |||
+ | === Date and Time === | ||
+ | |||
+ | Displays the date and time. | ||
+ | |||
+ | <p>Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></p> | ||
+ | |||
+ | <div style="border:1px solid blue; width:50%; padding:10px">Posted: July 17, 2007 at 7:19 am</div> | ||
+ | |||
+ | == Related == | ||
+ | |||
+ | {{Date Tags}} | ||
+ | |||
+ | {{Tag Footer}} | ||
+ | |||
+ | [[Category:Template Tags]] |
2014年6月8日 (日) 15:07時点における版
[http://wpdocs.sourceforge.jp{{localurl: テンプレート:en テンプレート:ja }} 日本語] •
目次
Description
Displays the time of the current post. To return the time of a post, use get_the_time(). This tag must be used within The Loop.
Usage
%%% <?php the_time( $d ); ?> %%%
Parameters
- $d
- (string) (optional) The format the time is to display in. Defaults to the time format configured in your WordPress options. See Formatting Date and Time.
- 初期値: なし
Examples
Default Usage
Displays the time using your WordPress defaults.
<p>Time posted: <?php the_time(); ?></p>
Time as AM/PM VS. 24H format
Displays the time using the format parameter string 'g:i a' (ex: 10:36 pm).
<p>Time posted: <?php the_time('g:i a'); ?></p>
Displays the time using the 24 hours format parameter string 'G:i' (ex: 17:52).
<p>Time posted: <?php the_time('G:i'); ?></p>
Date as Month Day, Year
Displays the time in the date format 'F j, Y' (ex: December 2, 2004), which could be used to replace the tag the_date().
<div><?php the_time('F j, Y'); ?></div>
Date and Time
Displays the date and time.
<p>Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></p>
Posted: July 17, 2007 at 7:19 am
Related
関数リファレンス、テンプレートタグ目次もご覧ください。