仮装したテンプレートでカテゴリ アーカイブを表示するための category.php を作成します。
次のようなカテゴリ ページ リンク: http://www.example.com/category/cat1/
これらのコードで問題なく、cat1の最後のアイテムが表示されます
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
// Some template code
<?php endwhile; ?>
<?php endif; ?>
しかし、cat1 のコンテンツの代わりに WP_Query または query_posts でクエリをカスタマイズしようとすると、サイトのすべてのカテゴリのコンテンツが表示されます
<?php query_posts( 'posts_per_page=30' ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
// Some template code
<?php endwhile; ?>
<?php endif; ?>
その理由と解決策とは?