I have a loop to get a list of terms for a taxonomy.
<?php
$terms = get_field('modell');
if( $terms ):
$total = count($terms);
$count = 1;
foreach( $terms as $term ):
?>
'<?php echo $term->slug; ?>'
<?php
if ($count < $total) {
echo ', ';
}
$count++;
endforeach;
endif;
?>
The loop output is this:
'termname-one','termname-two','termname-three'
Now I want to save this output into variable ($termoutput) and insert it into a array of terms of following loop:
<?php
query_posts( array(
'post_type' => 'posttypename',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'systems',
'field' => 'slug',
'terms' => array($termoutput)
)
)
) ); ?>
Is there a way to achive this? Thank you!