0
我正在嘗試在wordpress中創建一個頁面,其中顯示了5個最近的帖子。 我能夠成功地做到這一點。使用wp_get_recent_posts在帖子內獲取圖像
但是,我無法檢索該帖子內部存在的圖像。
我使用此代碼來檢索發佈網址和發佈圖片。 (URL後工作正常!)
$args = array('numberposts'=>'5');
$recentposts = wp_get_recent_posts($args);
foreach($recentposts as $post){
$v = $post['ID'];
$postlink = get_permalink($v);
$postimg = get_the_post_thumbnail($v);
}