【发布时间】:2009-08-25 14:26:53
【问题描述】:
我正在修改最近更改 WordPress 插件以显示日期。我可以回显日期但无法格式化;例如,mm/dd/yyyy。
我希望 post_modified 日期为 mm/dd/yyyy。
我试过了--
echo '<li>'.$RecentChange->post_modified('m/d/Y').
--但这会导致插件停止显示帖子,并且通常会破坏网站。
下面是插件中的相关块--
/* define full SQL request */
$rc_sql = "SELECT post_date, post_modified, post_title, ID FROM wp_posts WHERE ".$rc_content_sql." ORDER BY post_modified DESC LIMIT ".$rc_number;
global $wpdb;
echo $before_widget;
echo $before_title.$rc_title.$after_title.'<ul>';
$RecentChanges = $wpdb->get_results($rc_sql);
if ($RecentChanges)
foreach ($RecentChanges as $RecentChange) :
$rc_url = get_page_link($RecentChange->ID);
echo '<li>'.$RecentChange->post_modified.' <a href='.$rc_url.'>'.$RecentChange->post_title.'</a></li>';
endforeach;
echo '</ul>'.$after_widget;
$wpdb->flush();
}
【问题讨论】:
-
我使用的是 WordPress 2.8.4。 PHP 版本为 4.3.9。
标签: wordpress