谢谢您的回答!。我在寻找一个更完整的解决方案。我想出来了。
echo \'<div class="row profiles">\';
$terms = get_terms("clinical-programs");
if ( !empty( $terms ) && !is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
//View faculty member by clinical programs
$view_by_clinical_programs_args = get_posts(array(
\'post_type\' => \'faculty-clinical\',
\'posts_per_page\' => -1,
\'orderby\' => \'title\',
\'order\' => \'ASC\' ,
\'tax_query\' => array(
array(
\'taxonomy\' => \'clinical-programs\',
\'field\' => \'slug\',
\'terms\' => $term->slug
)
)
));
echo \'<div class="col-lg-12">\';
echo "<h3>" . $term->name . "</h3>";
echo \'<div class="row">\';
foreach ( $view_by_clinical_programs_args as $post ) {
//var_dump($post);
get_template_part( \'content-faculty-clinical-profiles-medium\' );
}
}
echo "</div>";
echo "</div>";
}
echo\'</div>\';// end row