I am wanting to show the current taxonomy product category title in the single product page.
The code below works, but returns all product categories. I need some help singling out the current category.
<?php
global $post;
$args = array( 'taxonomy' => 'product_cat',);
$terms = wp_get_post_terms($post->ID,'product_cat', $args);
$count = count($terms);
if ($count > 0) {
foreach ($terms as $term) {
echo '<div style="direction:rtl;">';
echo 'Category: ' . $term->name;
echo '</div>';
}
}
?>
After a few hours of experimenting and searching, you guys are my last hope for a solution. Thanks.