我有一個頁面,可能會顯示類別的帖子。
我使用此代碼如何獲得帖子縮略圖網址
<div id="grid" class="grid-container" style="display: block;">
<ul class="grid columns-2">
<?php
$args = array(
'category' => 0,
'numberposts' => 9,
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true);
$recent_posts = wp_get_recent_posts($args);
foreach($recent_posts as $recent){
echo '<li><a href="' . get_permalink($recent["ID"])
. '" title="'.$recent["post_title"].'" ><img class="aligncenter wp-image-80" src="" alt="'.$recent["post_title"].'"/></a>
<h4>'.$recent["post_title"].'</h4></li> ';
}
?>
</ul>
</div>
,問題是,我無法顯示的縮略圖。
我試圖找到如何獲得張貼縮略圖網址並將其放入它
通行證$最近[ 「ID」]像get_the_post_thumbnail($ recent [「ID」],'thumbnail');檢查我的答案! –
可能重複[如何獲得WordPress發佈特色圖片url](http://stackoverflow.com/questions/11261883/how-to-get-wordpress-post-featured-image-url) –
這個問題是重複的。答案可以在「http://stackoverflow.com/questions/11261883/how-to-get-wordpress-post-featured-image-url」 –