how to echo a custom taxonomy term from an array of term

Question

I have custom post type products & custom taxonomy product_type which has many terms & the products can have multiple product_type terms assigned to it Ex. A Samsung TV Model post has product_type as New arrivals , featured & tv .
I am trying to output only the specific custom taxonomy term [hyperlink] from an array on a single products post :-

if( has_term( array( 'laptop', 'TV', 'phone', 'tablet' ), 'product_type' ) ) :
  // Do stuff here
else :
  // DONT SHOW ANYTHING
endif;
?>

entering a text instead of // Do stuff here in above code works. I want to echo the actual tax term from that array. Tried echo $term; , echo get_the_term(); but it doesnt work. How do i output the custom term from this array ?

0
Charlesbz 4 years 2018-02-27T09:19:55-05:00 0 Answers 72 views 0

Leave an answer

Browse
Browse