我正在使用以下
<?php
function custom_echo($x)
{
if(strlen($x)<=150)
{
echo $x;
}
else
{
$y=substr($x,0,150) . '...';
echo $y;
}
}
// Include the wp-load'er
include('../../blog/wp-load.php');
// Get the last 10 posts
// Returns posts as arrays instead of get_posts' objects
$recent_posts = wp_get_recent_posts(array(
'numberposts' => 4
));
// Do something with them
echo '<div>';
foreach($recent_posts as $post) {
echo '<a class="blog-title" href="', get_permalink($post['ID']), '">', $post['post_title'], '</a><br />', $post['post_date'], custom_echo($post['post_content']), '<br /><br />';
}
echo '</div>';
?>
我遇到的问题是 $post['post_date'] - 它出现在 2012-12-03 13:59:56 - 我只想在 2012 年 12 月 3 日看到这个。我不知道该怎么走关于它。我知道还有其他一些与此类似的解决方案,但我对此并不陌生,并且真的不理解它们......?
帮助?
谢谢。