【发布时间】:2016-03-24 20:48:20
【问题描述】:
您好,我有一个名为“support-team-doc”的自定义帖子类型和一个名为“support_team_docs”的自定义分类,其类别如下:
Support Teams Group
-- Accounts
-- IT
-- Marketing
-- Risk & Compliance
每个类别都有许多帖子;我不希望子类别中的帖子显示在任何类别页面上; atm 子类别“帐户、IT、营销、风险合规”中的任何帖子都显示如下:“支持团队组”;我尝试了以下方法:
<?php
$termsTextarea = get_queried_object();
$args = array(
'post_type' => 'support-team-doc',
'tax_query'=>
array(
'taxonomy' => 'support_team_docs',
'field' => 'slug',
'terms' => $termsTextarea->slug,
'include_children' => false,
),
);
$query1 = new WP_Query( $args );
while ( $query1->have_posts() ) : $query1->the_post();
get_template_part( 'content', 'support_team_docs' );
endwhile; ?>
我不知道我做错了什么。
【问题讨论】:
标签: php wordpress custom-post-type children custom-taxonomy