I have the following code and i cant print the term. I use .&brand->name.
but anything happens. If i type the exactly words it works but i need it work and o other brand taxonomies too.
Any help?
<?php
// get products
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'pwb-brand', //brands are terms of 'pwb-brand' taxonomy
'field' => 'name', //search by term name
'terms' => array ('how to print????' ) //brand names here
)
)
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
} else {
echo __( 'No results.' );
}
wp_reset_postdata();
?>