Display product Brand above product title

This topic has 4 replies, 2 voices, and was last updated 5 years, 9 months ago ago by Olga Barlow

  • Avatar: wealthyboy
    wealthyboy
    Participant
    January 28, 2019 at 21:40

    Display Brand

    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.

    3 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 29, 2019 at 16:11

    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

    Avatar: wealthyboy
    wealthyboy
    Participant
    January 31, 2019 at 18:18

    Thanks ,i really appreciate,

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 31, 2019 at 19:10

    You are welcome!

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.