我在我的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/ –