Inside your post loop you can do;
if ( has_post_thumbnail()) {
echo get_the_post_thumbnail($post->ID, \'thumbnail\');
}
这将首先检查是否存在特征图像,如果存在,将以设置/媒体选项中设置的默认“缩略图”大小显示一个特征图像。
This would also work within your loop;
if ( has_post_thumbnail()) {
the_post_thumbnail(\'thumbnail\');
}
This would work (but can be used outside of your loop);
$id = get_the_ID();
echo get_the_post_thumbnail($id, \'thumbnail\');
除此之外,还有其他功能可以帮助您自定义尺寸,以满足您的需求。但是,上述默认值为150x150。
阅读:get_the_post_thumbnail阅读:the_post_thumbnail让我知道你怎么样了。