調用縮略圖的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,自定義長寬
