• Hi

    I want to display the brand name on the archive page, above the title. Is this possible? I know it is with some other plugin called “Perfect WooCommerce Brands”, but as I use a lot of your other plugins, I would try this out! ??

    Hope you can help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Premmerce

    (@premmerce)

    Hi, @zzbeck!

    Sorry for long response!

    Add this code to function.php of child theme:

    if (!function_exists('premmerce_get_brand_link')) {
        function premmerce_get_brand_link()
       {
           if(function_exists('premmerce_get_product_brand')){
               global $product;
    
               if($product){
                   $id = $product->get_ID();
                   $brand = premmerce_get_product_brand($id);
                   if ($brand) {
                       echo '<div class="brand-link"><a class="link link--secondary" href="' . get_term_link($brand->slug, 'product_brand') . '">' . $brand->name . '</a></div>';
                   }
               }
           }
       }
    }
    
    add_action('woocommerce_shop_loop_item_title', 'premmerce_get_brand_link', 5);

    Just try to get the archive page title using the get_the_archive_title(); function, It may work

    if (!function_exists(‘premmerce_get_brand_link’)) {
    function premmerce_get_brand_link()
    {
    if(function_exists(‘premmerce_get_product_brand’)){
    global $product;

    if($product){
    $id = $product->get_ID();
    $brand = premmerce_get_product_brand($id);
    if ($brand) {
    echo ‘<div class=”brand-link”>slug, ‘product_brand’) . ‘”>’ . $brand->name . ‘</div>’;
    }
    }
    }
    }
    }

    add_action(‘woocommerce_shop_loop_item_title’, ‘premmerce_get_brand_link’, 5);

    I got this working, can i make the brand name bold? like font-weight bold?

    i have this but i am confused on where to add it?

    <div class=”brand-link” style=font-weight: 700;”>

    where should i add it? kindly assist.

    Never mind i figured it out. Just incase anyone wants to do same, here is what i did:

    xxxxxxxxxx($brand->slug, ‘product_brand’) . ‘” style=”font-weight:bold;”>’ . $brand->name . ‘</div>’;

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display brand name above archive product title’ is closed to new replies.