Display product brand name inside the product loop on homepage

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

  • Avatar: r1nk
    r1nk
    Participant
    August 1, 2018 at 08:59

    Hello,

    How do I display products brand name and also hide it for some specific brand.

    I want to put it on top of the product title. I found the php file which is content-product.php . But no idea what code to write to display it.

    7 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    August 1, 2018 at 10:21

    Hello,

    To display brand on grid copy royal/woocommerce/content-product.php file into child theme and edit. Add the following code <?php et_product_brand_image(); ?> before the title http://prntscr.com/kd9yuf

    Regards

    Avatar: r1nk
    r1nk
    Participant
    August 1, 2018 at 15:33

    This code includes the widget div. (It prints the widget title and also the brand name got link to its respective page)

    What if I just want to echo the brand name without any href link and all?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    August 1, 2018 at 15:59

    Hello,

    Open royal/framework/woo.php, find function et_product_brand_image copy it into child theme functions.php and edit it according to your needs.

    Regards

    Avatar: r1nk
    r1nk
    Participant
    August 2, 2018 at 12:03

    Thank you.

    btw off topic, let’s say there is call for homepage like is_homepage() / is_single() , how about for brand page? How can I call it?

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    August 2, 2018 at 13:40

    Hello,

    You can try

    if ( is_tax( 'brand', '') ) {
        echo 'is_brand';
    }

    What exactly do you want to implement?

    Regards

    Avatar: r1nk
    r1nk
    Participant
    August 2, 2018 at 18:00

    Thank you thank you. It works. I used it too limit product title length to certain characters.

    Before this only worked for homepage & standard woocommerce taxanomy pages.

    One last thing, now only the related product slider not affect. Know how to call it?

    This is example of how I used it
    else if ( (is_home() || is_front_page() || is_tax( 'brand', '')) && get_post_type( $id ) === 'product' )

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    August 3, 2018 at 15:00

    Hello,

    If you want to change the products title length for the sliders copy and edit royal/woocommerce/content-product-slider.php

    Regards

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

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

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