我想通过父类别名称获取所有子类别,这是我当前的代码
<?php
//get all categories then display all posts in each term
$taxonomy = 'category';
$param_type = 'category__in';
$term_args=array(
'orderby' => 'name',
'order' => 'ASC',
);
$terms = get_terms($taxonomy,$term_args);
if ($terms) {
foreach( $terms as $term ) {
$args=array(
"$param_type" => array($term->term_id),
'post_type' => 'portfolio',
'category_name' => 'web-design',
'order' => 'ASC',
'post_status' => 'publish',
'posts_per_page' => 6,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) { ?>
正如您所看到的,我使用投资组合作为自定义帖子类型和网页设计作为父类别名称,我想获得父类别的所有子类别,即web-design