カテゴリページを開いたとき、そのカテゴリに関連するエントリだけをリスト表示したい場合。
is_categoryとget_the_categoryの合わせ技。
<?php if ( is_category() ) {?> <ul> <?php $cat = get_the_category(); $cat = $cat[0]; { ?> <?php if ( in_category($cat->cat_ID) ) { ?> <?php $posts = get_posts("category=". $cat->cat_ID . "&order=desc"); ?> <?php foreach($posts as $post): ?> <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_title(); ?></a></li> <?php endforeach; ?> <?php } ?> <?php } ?> </ul> <?php } ?>