wordpress サムネイル メモ
functions.php
/* 再度作成するサムネイルのサイズ設定 */
// 'large-feature'という名前で幅300px、高さ200pxのサムネイルを作成
add_image_size(
'large-feature'
, 300, 200 );
// 'middle-feature'という名前で幅200px、高さ100pxのサムネイルを作成
add_image_size(
'middle-feature'
, 200, 100, true );
// 'small-feature'という名前で幅100px、高さ80pxのサムネイルを作成
add_image_size(
'small-feature'
, 100, 80 );
content.php
// 設定した'large-feature'のサムネイルを出力
<?php the_post_thumbnail(
'large-feature'
); ?>
// 設定した'middle-feature'のサムネイルを出力
<?php the_post_thumbnail(
'middle-feature'
); ?>
// 設定した'small-feature'のサムネイルを出力
<?php the_post_thumbnail(
'small-feature'
); ?>