我只想显示帖子特定父类别中的子类别,并排除所有其他类别。
这是我的front-page.php
. 每个最近发布的帖子当前都使用get_the_category_list($post->ID)
.
我试过了get_the_category_list($parent, \'8\')
但它没有排除任何东西。8是我要保留的父类别的整数。非常感谢您的帮助!
这是我的代码:
<?php $the_query = new WP_Query(array(
\'post_type\' => \'post\',
\'category_name\' => \'genres\',
\'posts_per_page\' => 6,
\'post_status\' => \'publish\'
));
while ( $the_query->have_posts() ) : $the_query->the_post();
echo \'<div class="wrapper">
<div> // stuff with post title, image and excerpt </div>
<div>\' . get_the_category_list( $post->ID ) . \'</div>\';
endwhile;
wp_reset_postdata(); ?>
I want to go from this:
父类别1、子类别1、父类别2、子类别2、父类别3、子类别3To this:
子类别1