<?php
$terms = get_terms(array(
'taxonomy' => 'pa_proizvoditel',
'hide_empty' => true,
'exclude' => '',
'pad_counts'=> true,
'parent' => 0
));
?>
$terms = get_terms( array(
'taxonomy' => 'pa_proizvoditel'
) );
foreach( $terms as $term ) {
$terms_ids[] = $term -> term_id;
}
$args = array(
'posts_per_page' => -1,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'pa_proizvoditel',
'field' => 'term_id',
'terms' => $terms_ids,
),
),
);
$custom_query = new WP_Query( $args );
if ( $custom_query->have_posts() ) :
while ( $custom_query->have_posts() ) :
$custom_query->the_post();
the_title();
echo get_field("name", $terms);
endwhile;
endif;
wp_reset_postdata();