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行: | ||
== | == 描述 == | ||
显示当前文章的发表时间。必须在[[WordPress:The Loop|The Loop]]内使用这个标签。 | |||
== | == 用法 == | ||
%%% <?php the_time('d'); ?> %%% | %%% <?php the_time('d'); ?> %%% | ||
== | == 例子 == | ||
=== | === 默认用法 === | ||
使用WordPress默认设置,显示时间。 | |||
<p>Time posted: <?php the_time(); ?></p> | <p>Time posted: <?php the_time(); ?></p> | ||
=== | ===上午/下午标记的时间格式和24小时的时间格式=== | ||
使用格式参数string <tt>'上午09:18 '</tt> (例如: 下午10:36)显示时间。 | |||
<p>Time posted: <?php the_time('g:i a'); ?></p> | <p>Time posted: <?php the_time('g:i a'); ?></p> | ||
使用24小时制时间格式参数string <tt>'G:i'</tt> (例如: 17:52)显示时间。 | |||
<p>Time posted: <?php the_time('G:i'); ?></p> | <p>Time posted: <?php the_time('G:i'); ?></p> | ||
=== | ===按年,月,日格式组合的日期 === | ||
以日期格式<tt>'F j, Y'</tt> (例如: 2004年12月2日),这个格式可以用来代替标签[[WordPress:Template Tags/the date|the_date()]]。 | |||
<div><?php the_time('F j, Y'); ?></div> | <div><?php the_time('F j, Y'); ?></div> | ||
=== | === 日期和时间 === | ||
显示日期和时间。 | |||
<p>Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></p> | <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"> | <div style="border:1px solid blue; width:50%; padding:10px">发表时间: 2007年7月17日上午 7:19 </div> | ||
== | == 参数 == | ||
; d : (''string'') | ; d : (''string'')显示时间的格式。默认为WordPress选项中设置的时间格式。请看看[[WordPress:Formatting Date and Time|日期和时间格式]]。 | ||
== | == 相关的 == | ||
{{ | {{标签日期标签}} | ||
{{ | {{标签 页底文字}} |
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选项中设置的时间格式。请看看日期和时间格式。