woocommerce function: add product title and brand to image alt tag in archive page
$10-30 USD
Pago na entrega
i’d like to use this code to add automatically product name and product brand to the alt text of images. `add_filter(‘wp_get_attachment_image_attributes’, ‘change_attachement_image_attributes’, 20, 2);
function change_attachement_image_attributes( $attr, $attachment ){
// Get post parent
$parent = get_post_field( ‘post_parent’, $attachment);
// Get post type to check if it’s product
$type = get_post_field( ‘post_type’, $parent);
if( $type != ‘product’ ){
return $attr;
}
/// Get title
$title = get_post_field( ‘post_title’, $parent);
$attr[‘alt’] = $title;
$attr[‘title’] = $title;
return $attr;
}`
this code add product title; how to add the brand with it separated with space
ID do Projeto: #22583979
Sobre o projeto
Concedido a:
Good day, I bid on your project as I feel confident I can complete this task. I have advanced English Skills and I can start working right away. My Skills are exactly what you are looking for. Send me a message so we c Mais