Вот еще вариант вывода подкатегории таксономий с записями:
<?php
$taxonomy = ‘team_type’;
$orderby = ‘name’;
$show_count = 0;
$pad_counts = 0;
$hierarchical = 1;
$title = »;
$empty = 1;
$args = array(
‘taxonomy’ => $taxonomy,
‘orderby’ => $orderby,
‘show_count’ => $show_count,
‘pad_counts’ => $pad_counts,
‘hierarchical’ => $hierarchical,
‘title_li’ => $title,
‘hide_empty’ => $empty
);
?>
<?php $all_categories = get_categories( $args );
//print_r($all_categories);
foreach ($all_categories as $cat) {
if($cat->category_parent == 0) {
$category_id = $cat->term_id;
// print_r($cat->term_id);
?>
<div class=»b-drop wow fadeInUp down»>
<div class=»b-drop__alsus down-toggle»><span class=»typo-uiuri»><?php echo $cat->name ?></span></div>
<div class=»b-drop__body down-body»>
<div class=»cn-cols-row cn-gutter-h-30 wow-delay cn-mb-70 cn-mb-30—sm»>
<?php
global $wp_query;
$wp_query = new WP_Query(array(
‘post_type’ => ‘team’,
‘posts_per_page’ => ’10’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘team_type’,
‘field’ => ‘term_id’,
‘terms’ => $cat->term_id
)
)
// ‘paged’ => get_query_var(‘paged’) ?: 1
));
while( have_posts() ){
the_post(); ?>
<div class=»cn-w-3_12 cn-w-6_12—sm cn-mb-30 cn-mb-30—sm»>
<div class=»cn-cols-row cn-gutter-h-30 procurement-block»>
<div class=»cn-w-6_12 cn-w-12_12—lg»>
<a href=»<?php the_permalink(); ?>»>
<img class=»s-procurement__img» src=»<?php echo get_the_post_thumbnail_url(); ?>» alt=»»>
</a>
</div>
<div class=»cn-w-6_12 cn-w-12_12—lg»>
<div>
<h5 class=»procurement-t»><a href=»<?php the_permalink(); ?>»><?php the_title(); ?></a></h5>
<p class=»deadline»><?php the_field( ‘deadline’ ); ?></p>
<div class=»text cn-mb-30″><?php echo wp_trim_words( get_the_content(), 40, ‘…’ );?></div>
<a class=’btn_procurement btn_last_news cn-m-0′ href=»<?php the_permalink(); ?>»><?php _e(‘Learn more’,’eu4′); ?></a>
</div>
</div>
</div>
</div>
<?php } wp_reset_query(); ?>
</div>
</div>
</div>
<?php } } ?>