This topic has 6 replies, 2 voices, and was last updated 3 years ago ago by Olga Barlow
Hey,
How to display brand’s description (html) in sidebar on product page? By default only logo is displayed.
Royal Theme
Hello,
Provide us with WP Dashboard and FTP access. We’ll help you with this. There is no option to enable that, so minor customization is required.
Regards
Hello,
Thank you for your offer to help, but unfortunately I can’t give access to anyone.
Could you tell me please any tips what file to find and what text to add?
p.s.
Good advice to add this option to your theme 😉
Hello,
1) Add the below code to child theme functions.php
add_shortcode('product_brand_single', 'et_product_brand_single');
function et_product_brand_single() {
global $post, $wpdb, $product;
$terms = wp_get_post_terms( $post->ID, 'brand' );
if(count($terms)>0) {
?>
<div class="product-brands">
<h4 class="widget-title"><span><?php esc_html_e('Product brand', 'royal-core') ?></span></h4>
<?php
foreach($terms as $brand) {
$image = '';
$thumbnail_id = absint( get_term_meta( $brand->term_id, 'thumbnail_id', true ) );
?>
<a href="<?php echo get_term_link($brand); ?>">
<?php
if ($thumbnail_id) :
$image = etheme_get_image( $thumbnail_id );
?>
<?php if($image != ''): ?>
<img src="<?php echo $image; ?>" title="<?php echo $brand->name; ?>" alt="<?php echo $brand->name; ?>" class="brand-image" />
<?php else: ?>
<?php echo $brand->name; ?>
<?php endif; ?>
<?php
else :
echo $brand->name;
endif; ?>
<div class="brand-description text-center">
<p><?php echo wp_specialchars_decode( $brand->description ); ?></p></div>
</a>
<?php
}
?>
</div>
<?php
}
}
2) Add below code to child theme style.css
.single-product-sidebar .sidebar-widget.product-brands {
display: none;
}
.brand-description p {
font-size: 14px;
}
3) Add below shortcode to Appearance > Widgets > Single product sidebar
[product_brand_single]
Regards
Hello,
Thanks a lot!!! It works! ^.^
Could you give me another advice please, how to rename the title “Product Brand” on product’s page?
Hello,
Edit the code I provided and change the title there
<?php esc_html_e('Product brand', 'royal-core') ?>
Regards
You must be logged in to reply to this topic.Log in/Sign up