我有自定义的帖子类型products
&;自定义分类法product_type
它有许多术语&;这个products
可以有多个product_type
分配给it的条款,例如。A Samsung TV Model
post的product\\u类型为New arrivals
, featured
&;tv
.我试图从单个products
职位:-
if( has_term( array( \'laptop\', \'TV\', \'phone\', \'tablet\' ), \'product_type\' ) ) :
// Do stuff here
else :
// DONT SHOW ANYTHING
endif;
?>
输入文本而不是// Do stuff here
在上述代码中工作。我想回显该数组中的实际税项。尝试echo $term;
, echo get_the_term();
但它不起作用。如何从此数组中输出自定义术语?