WordPress: Template Tags/the time:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == Displays the time of the current post. This tag must be used within WordPress:The Loop. == Usage == %%% <?php the_time('d'); ?> %%% == Examples == === Default ...)
 
无编辑摘要
 
(未显示另一用户的1个中间版本)
第1行: 第1行:
== Description ==
== 描述 ==


Displays the time of the current post.  This tag must be used within [[WordPress:The Loop]].
显示当前文章的发表时间。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。


== Usage ==
== 用法 ==


%%% <?php the_time('d'); ?> %%%
%%% <?php the_time('d'); ?> %%%


== Examples ==
== 例子 ==


=== Default Usage ===
=== 默认用法 ===


Displays the time using your WordPress defaults.
 
使用WordPress默认设置,显示时间。


  &lt;p&gt;Time posted: <?php the_time(); ?>&lt;/p&gt;
  &lt;p&gt;Time posted: <?php the_time(); ?>&lt;/p&gt;


=== Time as AM/PM VS. 24H format===
===上午/下午标记的时间格式和24小时的时间格式===


Displays the time using the format parameter string <tt>'09:18 am'</tt> (ex: 10:36 pm).
使用格式参数string <tt>'上午09:18 '</tt> (例如: 下午10:36)显示时间。


  &lt;p&gt;Time posted: <?php the_time('g:i a'); ?>&lt;/p&gt;
  &lt;p&gt;Time posted: <?php the_time('g:i a'); ?>&lt;/p&gt;


--


Displays the time using the 24 hours format parameter string <tt>'G:i'</tt> (ex: 17:52).
使用24小时制时间格式参数string <tt>'G:i'</tt> (例如: 17:52)显示时间。


  &lt;p&gt;Time posted: <?php the_time('G:i'); ?>&lt;/p&gt;
  &lt;p&gt;Time posted: <?php the_time('G:i'); ?>&lt;/p&gt;


=== 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 [[WordPress:Template Tags/the date|the_date()]].
以日期格式<tt>'F j, Y'</tt> (例如: 2004年12月2日),这个格式可以用来代替标签[[WordPress:Template Tags/the date|the_date()]]


  &lt;div&gt;<?php the_time('F j, Y'); ?>&lt;/div&gt;
  &lt;div&gt;<?php the_time('F j, Y'); ?>&lt;/div&gt;


=== Date and Time ===
=== 日期和时间 ===
 
Displays the date and time.


显示日期和时间。
  &lt;p&gt;Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?>&lt;/p&gt;
  &lt;p&gt;Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?>&lt;/p&gt;


<div style="border:1px solid blue; width:50%; padding:10px">Posted: July 17, 2007 at 7:19 am</div>
<div style="border:1px solid blue; width:50%; padding:10px">发表时间: 2007年7月17日上午 7:19 </div>


== Parameters ==
== 参数 ==


; d : (''string'') The format the time is to display in.  Defaults to the time format configured in your WordPress options.  See [[WordPress:Formatting Date and Time]].
; d : (''string'')显示时间的格式。默认为WordPress选项中设置的时间格式。请看看[[WordPress:Formatting Date and Time|日期和时间格式]]


== Related ==
== 相关的 ==


{{Tag Date Tags}}
{{标签日期标签}}


{{Tag Footer}}
{{标签 页底文字}}

2008年7月11日 (五) 17:55的最新版本

描述[ ]

显示当前文章的发表时间。必须在The Loop内使用这个标签。

用法[ ]

%%% <?php the_time('d'); ?> %%%

例子[ ]

默认用法[ ]

使用WordPress默认设置,显示时间。

<p>Time posted: <?php the_time(); ?></p>

上午/下午标记的时间格式和24小时的时间格式[ ]

使用格式参数string '上午09:18 ' (例如: 下午10:36)显示时间。

<p>Time posted: <?php the_time('g:i a'); ?></p>


使用24小时制时间格式参数string 'G:i' (例如: 17:52)显示时间。

<p>Time posted: <?php the_time('G:i'); ?></p>

按年,月,日格式组合的日期[ ]

以日期格式'F j, Y' (例如: 2004年12月2日),这个格式可以用来代替标签the_date()

<div><?php the_time('F j, Y'); ?></div>

日期和时间[ ]

显示日期和时间。

<p>Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></p>
发表时间: 2007年7月17日上午 7:19

参数[ ]

d
(string)显示时间的格式。默认为WordPress选项中设置的时间格式。请看看日期和时间格式

相关的[ ]

模板:标签日期标签