parent category before product title on single product page
-
Hi guys, At the moment the situation on my single product page is like attached image. In the breadcrumb you see Home/parent category (yellow)/sub category (dark-blue)/product title (light blue). Right from the image you see from top to bottom: sub category (dark blue) / product title (light blue) / price etc. I like this sub category (dark blue) to show the parent category (yellow) Sometimes a product has more steps between parent-category and product. This doesn’t matter, I always want this to be the parent category. Hopefully you are able to help. currently used snippet:
<?php
$terms = get_the_terms( get_the_ID(), ‘product_cat’ );
if ( $terms && ! is_wp_error( $terms ) ) :
if ( ! empty( $terms ) ) {
echo ‘<span class=”woo-custom-category”>’ . $terms[0]->name . ‘</span>’;
}?>
<?php endif;?>`
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘parent category before product title on single product page’ is closed to new replies.