2013-03-05 125 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");