打印子类别帖子包括(标题,永久链接和摘录)在类别内页面模板


Wordpress: Print Subcategory Posts Including (Title, Permalink and excerpt) under Category inside page template

嗨,基本上我有一个页面模板。就像目录一样。我不需要插件,因为我仍然想控制代码。

我只是想问这是否可能?

==>目录页(分类6月刊)

Then打印特定类别下的所有子类别信息。像这样的格式:

=>子类别标题

 then Posts Under (this) Subcategory
 -> Post Title including Permalink
 -> Post Excerpt
 -> Post Title including Permalink
 -> Post Excerpt
 -> Post Title including Permalink
 -> Post Excerpt

=>子类别2 title

 then Posts Under (this) Subcategory
 -> Post Title including Permalink
 -> Post Excerpt
 -> Post Title including Permalink
 -> Post Excerpt
 -> Post Title including Permalink
 -> Post Excerpt

=>子类别3 title

 then Posts Under (this) Subcategory
 -> Post Title including Permalink
 -> Post Excerpt
 -> Post Title including Permalink
 -> Post Excerpt
 -> Post Title including Permalink
 -> Post Excerpt

等等…

我只是想知道如果wordpress有这个方法提取子类别在特定的帖子类别..我怎么能在模板中适当地显示它,如果我要为下一个问题创建另一个表内容,它将自动打印所有子类别信息。请帮帮我。

谢谢

试试这个…不是测试

<?php 
        $args = array(
            'type'                     => 'post',
            'child_of'                 => 0,
            'parent'                   => '1', //Only get child categories
            'orderby'                  => 'name',
            'order'                    => 'ASC',
            'hide_empty'               => 1,
            'taxonomy'                 => 'category',
            'pad_counts'               => false 
        );
        $categoryList = get_categories($args);
            if(!empty($categoryList)){
            foreach($categoryList as $category){
                          $postArgs = array(
                    'cat' => $category->id,
                            'post_type' => 'post'   //Use other options as needed
                         );                    
                query_posts($postArgs);
                        while ( have_posts() ) : the_post();
                echo get_the_title();
                echo get_permalink();
                        echo get_the_excerpt();
                endwhile;
             }
             }
    ?>