开发者

How do I show the 'blog last updated' time in Wordpress?

I want to show the time of the last blog update at the header of my wordpress blog. It's not the last update time of a post but rather any post or page (i.e.开发者_如何学运维 any last update done in the blog)

e.g. Format:

Now: Tuesday, March 16, 2010 | Last Update: 6:09 PM ET

Is there any template tag to accomplish this?


I don't know of any template tags that can do this, but you can access the database directly and find the "newest" post or page. Try something like this (I have no wordpress-installation available for test right now):

<?php $newest = $wpdb->get_row("select post_modified from $wpdb->posts 
where post_type in ('page', 'post') and post_status = 'publish' order by post_modified desc");
 echo mysql2date('m/d/Y',$newest->post_modified);
 ?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜