我知道如何使用以下代码获取最后或最旧的post数据
$posts = get_posts(array(
\'post_type\' => \'post\',
\'order_by\' => \'publish_date\',
\'order\' => \'ASC\'
));
And then I will get the date from the first array itself, but is there any quickest way to get that ?
我知道如何使用以下代码获取最后或最旧的post数据
$posts = get_posts(array(
\'post_type\' => \'post\',
\'order_by\' => \'publish_date\',
\'order\' => \'ASC\'
));
And then I will get the date from the first array itself, but is there any quickest way to get that ?
function is_first() {
global $post;
$loop = get_posts( \'numberposts=1&order=ASC\' );
$first = $loop[0]->ID;
return ( $post->ID == $first ) ? true : false;
}
你也可以用这个我想检索最新帖子的修改日期。为此,首先我收到了最新的帖子:$latest_post = get_posts()[0]; 我是否可以确定返回的对象始终是最新的帖子,或者是否存在以下情况:get_posts() 有什么不同?