我想在我的一个小部件中输出帖子的特色图像的缩略图?在 Wordpress 中,我怎样才能在循环中做到这一点。我正在使用版本 3.3.1
问问题
2163 次
1 回答
1
您可以使用
<?php the_post_thumbnail(); ?>
或者,如果您只想要图像 src 而不是所有 wordpress 的 html 输出,请使用以下命令:
<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
参考:
http://codex.wordpress.org/Function_Reference/the_post_thumbnail
http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
于 2012-03-17T18:28:47.740 回答