<?php $brands = get_terms(); print_r($brands);?>
[78] => WP_Term Object ( [term_id] => 1 [name] => Uncategorized [slug] => uncategorized [term_group] => 0 [term_taxonomy_id] => 1 [taxonomy] => category [description] => [parent] => 0 [count] => 1 [filter] => raw ) [79] => WP_Term Object ( [term_id] => 142 [name] => USED ITEM [slug] => used-item [term_group] => 0 [term_taxonomy_id] => 142 [taxonomy] => product_brand [description] => [parent] => 0 [count] => 404 [filter] => raw )
[name] => USED ITEM
<?php $terms = get_the_terms( $product_id, 'product_brand' ); foreach ($terms as $term) { $product_cat = $term->name; } echo '<span style="color:red">'.$product_cat.'</span>'; ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)