wordpress最新文章显示日期代码
九月 4th, 200972,190 views
在wordpress侧边栏显示最新文章并显示发布日期的代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <li><h4>最新发布</h4> <ul> <?php $args=array( 'showposts'=>10,//修改此数值以决定显示文章数量的上限 'caller_get_posts'=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?><small>(<?php the_time('m.d.y') ?>)</small> </a></li> <?php endwhile; } ?></ul></li> |
效果如下:
本文来源:随便翻翻
原文地址:http://anyff.com/2009/09/wordpress-recent-post-date-code/
很好的一篇文章..