2013-03-05 124 views
0

嗨我試圖顯示一個類別下的所有帖子。看起來這Wordpress類別列表

  • 遊戲

      • 齒輪戰爭

        (所有郵政局下比賽放在這裏)

      • 幾何戰爭

        (所有郵政局下幾何戰爭放在這裏)

這就是我怎麼類的帖子在WordPress時,我讓他們,讓他們不要搞混。但是,當我嘗試渲染它們時仍然會這樣做。所有在G下的帖子都顯示在每個遊戲標題下(戰爭的齒輪,幾何戰爭)。我只想要那些在戰爭中有任何職位的職位,他們應該在戰爭的齒輪下顯示。不在幾何戰爭之下。

這裏是我的代碼:

<?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 } ?> 

謝謝!

回答

1

變化

query_posts("cat=$cat_id&post_per_page=9999"); 

query_posts("cat=" . $categories_item->term_id . "&post_per_page=9999");