ホームページで複数のループを使いたいです。まず、特定のカテゴリの投稿を表示し、次に上記のカテゴリを含むすべての投稿を表示します。 しかし、query_postsを使用せずに2番目のループを使用すると、前のループの投稿は除外されます。例えばワードプレス:複数のポストループを使用していますか?
:
<div class="special_category" >
<?php query_posts('category_name=special_cat&posts_per_page=10'); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- will get special_cat posts -->
<?php endwhile;?>
</div>
<div class="latest_posts">
<!-- as i want do display all posts, so I don't use query_posts. -->
<?php while (have_posts()) : the_post(); ?>
<!-- this will exclude the posts of above special_cat -->
<?php endwhile;?>
</div>
IはQUERY_STRINGを使用する場合、第二のループに(さえ任意の引数を渡すことなく)、それはポストを含みます。
<div class="latest_posts">
<!-- i used query_posts without any arguments -->
<?php query_posts(''); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- now this will get all posts -->
<?php endwhile;?>
</div>
私の質問は、そういう意味で働くことです。上記のループの投稿を除外するか、何か間違っていますか?なぜそれはquery_postsを使用せずにすべての投稿を得ることはありませんか?おかげさまで あなたは複数の投稿は、あなたがwp_queryを使用する必要がありますループを使用する場合、それは
最初のループの後にここにhttp://codex.wordpress.org/Function_Reference/wp_reset_query
ありがとうございました。それは素晴らしいです:) – user966582