Hi I can display subcategory name in current product page (single product page) but it showed all the subcategory name. I just want to show subcategory name based on the product selected.
I have one category with two subcategories "black and blue". product A have black subcategory, product B have blue subcategory. when I go to product A, it show black and blue subcategory. All I want is when I go to product A, it only show black subcategory.
here my code
$args = array(
'hierarchical' => 1,
'show_option_none' => '',
'hide_empty' => true,
'parent' => 106,
'taxonomy' => 'product_cat'
);
$subcats = get_categories($args);
echo '<p class=breadcrumb_single>Subject ';
foreach ($subcats as $sc) {
$link = get_term_link( $sc->slug, $sc->taxonomy );
echo '<b><a href="'. $link .'">'.$sc->name.'</a></b> ';
}
echo '</p>';
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745388184a4625535.html
评论列表(0条)