Display product Brand above product title

3 replies2 participantsUpdated by Olga Barlow

  • Avatar: wealthyboy
    wealthyboy
    Participant

    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
    Participant

    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

    Thanks ,i really appreciate,

    Avatar: Olga Barlow
    Olga Barlow
    Participant

    You are welcome!

    Regards

Want to reply? Log in, or register with your ThemeForest purchase code, to reply to this topic.

Login / Register