こんにちは、カテゴリの下にすべての投稿を表示しようとしています。こんな感じ
ゲーム
G
戦争の歯車
(ゲームの下のすべての投稿はここに移動します)
ジオメトリ戦争
(Geometry wars の下のすべての投稿はここに移動します)
そして、それが私が投稿を作成するときにワードプレスで投稿を分類する方法です。しかし、私がそれらをレンダリングしようとすると、それでもそうします。G の下にあるすべての投稿は、すべてのゲーム タイトル (Gears of war、geometry wars) の下に表示されます。ジオメトリ戦争でもありません。
これが私のコードです:
<?php
$cat_id = get_query_var('cat');
$catlist = get_categories('hide_empty=0&child_of=' . $cat_id);
$cat_child = get_field('frontend_name' , 'category_' . get_query_var('cat' ));
foreach($catlist as $categories_item) {
echo "<ol>";
echo '<h3><a href="' . get_category_link( $categories_item->term_id ) . '" ' . '>' . $categories_item->description .'</a> </h3> ';
query_posts("cat=$cat_id&post_per_page=9999");
if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink();?>">
<?php the_title(); ?>
</a></li>
<?php endwhile; endif; ?>
<?php echo "</ol>"; ?>
<?php } ?>
ありがとう!