This topic has 4 replies, 2 voices, and was last updated 5 years, 10 months ago ago by Olga Barlow
I want the brand name for each product to be on top of the product title like the image above .I want it for the product and shop pages.
Thanks.
Hello,
You can implement this by some additional customization.
Install and activate Legenda child theme if you did not do this before.
Copy legenda/woocommerce/content-product.php and legenda/woocommerce/content-product-slide.php files into child theme. Edit files and add the code below before the product name http://prntscr.com/mdstcp
<?php
$terms = wp_get_post_terms( $post->ID, 'brand' );
if ( ! is_array( $terms ) && ! is_object( $terms ) ) $terms = array();
$count = count($terms);
$i = 0;
?>
<div class="product-brand">
<?php foreach($terms as $brand) : ?>
<?php $i++ ?>
<a href="<?php echo get_term_link($brand); ?>"><?php echo $brand->name; ?></a>
<?php if ($count>$i): ?>,<?php endif ?>
<?php endforeach; ?>
</div>
Add the code below to child theme style.css
.product-brand a {
color: #6f6f6f;
text-transform: uppercase;
font-size: 12px;
}
.product-brand {
margin: 0 10px 10px;
}
Regards
Thanks ,i really appreciate,
You are welcome!
Regards
You must be logged in to reply to this topic.Log in/Sign up