Hello Luke Nielsen,
>> https://ibb.co/sd0Bm5Vx
You only need to install code snippers plugin and paste this script:
——————————————-
add_action( ‘woocommerce_shop_loop_item_title’, ‘afiseaza_logo_brand_sub_imagine_woodmart’, 5 ); // Prioritate 5 pentru a rula devreme
function afiseaza_logo_brand_sub_imagine_woodmart() {
global $product;
$product_id = $product->get_id();
// Presupunem că taxonomia pentru branduri este ‘product_brand’ (verifică dacă WoodMart folosește altceva)
$brands = wp_get_post_terms( $product_id, ‘product_brand’ );
if ( ! empty( $brands ) && ! is_wp_error( $brands ) ) {
// Afișăm doar primul brand găsit, dacă sunt mai multe
$brand = $brands[0];
$thumbnail_id = get_term_meta( $brand->term_id, ‘thumbnail_id’, true ); // WoodMart adesea stochează ID-ul thumbnail-ului în term meta
if ( $thumbnail_id ) {
$logo_url = wp_get_attachment_url( $thumbnail_id );
if ( $logo_url ) {
// Poți adăuga clase CSS pentru stilizare
echo ‘<div class=”brand-logo-container sub-imagine”>’;
echo ‘‘; // Adaugă link către pagina brandului
echo ‘
name ) . ‘ Logo” style=”max-width: 140px; height: auto; margin-top: 5px; margin-bottom: 5px; display: block; margin-left: auto; margin-right: auto;” />’; // Adaugă stil inline simplu sau folosește clasa CSS
echo ‘‘;
echo ‘</div>’;
}
}
}
}
——————————————-
Attachments:
You must be
logged in to view attached files.