投稿記事を作成したときにアップロードした画像のサムネイルを
アイキャッチ画像として使う方法
オリジナルテーマの場合、アイキャッチ画像を使用するための宣言が必要
function.phpに以下の記述を行う
<?php
function mysetup() {
add_theme_support( 'post-thumbnails' );
}
add_action( 'after_setup_theme', 'mysetup' );
?>
ページ内記述サンプル(カテゴリー1、6記事公開、横80px縦60px)
<ul class="promotionList">
<?php query_posts('cat=1&showposts=6');
if (have_posts()) : while (have_posts()) : the_post(); ?>
<li class="clearfix"><a href="<?php the_permalink(); ?>" style="float:left; margin:0 10px 10px 0;">
<?php the_post_thumbnail(array(80,60)); ?></a>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; endif; wp_reset_query(); ?>
</ul>
画像アップロード時や記事作成時にアイキャッチ画像の設定をしておけば、他のページで
サムネイル画像がアイキャッチ画像として表示される。