WP函数---the_time

模板标签- the_time()

说明

该标签显示当前文章的发表时间。该标签必须用在主循环(loop)中。

用法

<?php the_time( $d ); ?> 

参数

$d

(字符串)(可选)所显示时间的时间格式。默认为WordPress管理面板中设定的时间格式。参见设置日期和时间格式

示例

默认用法

根据WordPress后台设置显示时间

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

十二小时制VS 二十四小时制

利用格式参数字符串'09:18 am' (如 10:36 pm)显示文章发表时间。

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

----

利用24小时格式参数字符串 'G:i' (如:17:52) 显示文章发表时间:

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

发表日期为月、日、年格式

以 'F j, Y' 日期格式(如: December 2, 2004)显示文章发表时间,可代替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>  

 

转自 

http://www.wordpress.la/codex-%E6%A8%A1%E6%9D%BF%E6%A0%87%E7%AD%BE-the_time().html

猜你喜欢

转载自king-lm.iteye.com/blog/1926376