Home Forums WoodMart support forum Brand image on product archive Reply To: Brand image on product archive

#38862

iRiDiuM
Participant

ok!

i find a function and customized it, but, cant find the correct term id for image:

pa_marca-image

function brands_in_loop(){
    global $product;
    $product_id = $product->id;
    $product_brands =  wp_get_post_terms($product_id, 'pa_marca');
    if(!empty($product_brands)){
        echo '<div class="custom-loop-brands">';
        foreach ($product_brands as $brand) {           
                  $attachment_id = get_term_meta( $brand->term_id, 'pa_marca-image', 1 );

                  $attachment_html = wp_get_attachment_image($attachment_id,$atts['image_size']);

                  if(!empty($attachment_html)){
                    echo '<span class="marca-archivos">'.$attachment_html.'</span>';
                  }else{
                    echo '<span class="marca-archivos">'.$brand->name.'</span>';
                  }
              
        }
        echo '</div>';
    }
}
add_action('woocommerce_before_shop_loop_item_title', 'brands_in_loop');

And the position is on top before image, i want to hook before tittle or above, not before image.

woocommerce_before_shop_loop_item_title

Some helps?

Thanks a lot