我在我的wp主页中创建了一个帖子循环,其中5个最近的帖子被一个在另一个之下显示。 循环WP数据的代码Wordpress get_the_date()只检索帖子ID
$args = array('numberposts'=>'5');
$recentposts = wp_get_recent_posts($args);
foreach($recentposts as $post){
$v = $post['ID'];
echo 'Title:'.get_the_title($v).'<br>';
echo 'Date:' .get_the_date($v).'<br>';
}
标题部分作品完美,但日期部分只显示后,没有任何其他的ID。
我在做什么错?
始终尝试检查函数引用以查看它所需的参数:-https://developer.wordpress.org/reference/functions/get _the_date/ –