我有一个页面,可能会显示类别的帖子。
我使用此代码如何获得帖子缩略图网址
<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” –