我正在尝试创建一个页面,其中列出了按术语分组的一个分类中的所有帖子,并在每个组之前显示术语描述 . 所以一个例子是有一个页面,其中包含团队1的描述,然后是团队1成员的列表,然后是团队两个描述和团队两个成员的列表等 . 贝娄是我到目前为止所拥有的 . 它显示按术语分组的所有帖子,但它仅显示第一个术语的说明 . 当我试图在循环中放入“echo $ term-> description”时,它将描述放在每个帖子的前面(这是我期望的......)但我不知道如何在每个帖子前面得到描述一组术语 .

<?php  
$terms = get_terms( 'taxonomy_team', array(
    'orderby'    => 'count',
    'hide_empty' => 0
) );
?>
<?php foreach( $terms as $term ) {
    $args = array(
        'post_type' => 'team',
        'taxonomy_team' => $term->slug
    );
    $query = new WP_Query( $args );?>
    <div class=" col-sm-10">         
  <?php                
    echo $term->description; ?>
    <?php    while ( $query->have_posts() ) : $query->the_post(); ?>        
      <?php the_content();?>        
  </div>
  <?php endwhile;        
    wp_reset_postdata();
} ?>