wordpress调用缩略图/特色图url

调用缩略图的url

<a href="<?php the_post_thumbnail_url( 'full' ); ?>"><?php the_post_thumbnail(); ?></a>

如果不加链接

<?php if ( has_post_thumbnail() ) { ?>
<?php the_post_thumbnail(); ?>
<?php } else {?>
<img src="这里填写默认图片地址" />
<?php } ?>

参数设置

the_post_thumbnail(); // 无参数,默认调用Thumbnail
the_post_thumbnail('thumbnail'); // Thumbnail (默认尺寸 150px x 150px max)
the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large'); // Large resolution (default 640px x 640px max)
the_post_thumbnail('full'); // Full resolution (original size uploaded)全分辨率(上传原始尺寸)
the_post_thumbnail( array(100,100) ); // Other resolutions,自定义长宽