Hello
owl gallery thumbnails showing “undefined” in code TITLE if thumbnail does not have title defined in media. Which is somewhat normal but It would be better showing empty string or showing product title as the “![]()
Is it possible without cloning the product-image.php template?
Going ahead:
I cloned that file and could only change behaviour for the first thumbnail. Not the others.
$thumbnail_title = get_post_field( 'post_title', $post_thumbnail_id );
$thumbnail_caption = get_post_field( 'post_excerpt', $post_thumbnail_id );
if(empty($thumbnail_title) || $thumbnail_title == 'undefined'){
$thumbnail_title = get_post_field( 'post_title', $product->get_id() );
}
if(empty($thumbnail_caption)){
$thumbnail_caption = get_post_field( 'post_excerpt', $product->get_id() );
}
if(empty($thumbnail_caption)){
$thumbnail_caption = $thumbnail_title;
}
$attributes = array(
'title' => $thumbnail_title,
'data-caption' => $thumbnail_caption,
'data-src' => isset( $full_size_image[0] ) ? $full_size_image[0] : '',
'data-large_image' => isset( $full_size_image[0] ) ? $full_size_image[0] : '',
'data-large_image_width' => isset( $full_size_image[1] ) ? $full_size_image[1] : '',
'data-large_image_height' => isset( $full_size_image[2] ) ? $full_size_image[2] : '',
'class' => apply_filters( 'woodmart_single_product_gallery_image_class', 'wp-post-image' ),
);
Steps to reproduce behaviour
1. go here: https://collantlover.it/collant/collant-effetto-autoreggenti-e-slip-art-301/
2. place mouse over first and other thumbnails.
Attachments:
You must be
logged in to view attached files.