How To Replace Default Alt Value In Gallery Modules With The One You Can Set Under Attachment Settings - kary4/divituts GitHub Wiki
Open up includes/builder/main-modules.php replace this snippet:
$image_output = sprintf(
'<a href="%1$s" title="%2$s">
<img src="%3$s" alt="%2$s" />
<span class="et_overlay%4$s"%5$s></span>
</a>',
esc_url( $attachment->image_src_full[0] ),
esc_attr( $attachment->post_title ),
esc_url( $attachment->image_src_thumb[0] ),
( '' !== $hover_icon ? ' et_pb_inline_icon' : '' ),
$data_icon,
);
with:
$image_output = sprintf(
'<a href="%1$s" title="%2$s">
<img src="%3$s" alt="%6$s" />
<span class="et_overlay%4$s"%5$s></span>
</a>',
esc_url( $attachment->image_src_full[0] ),
esc_attr( $attachment->post_title ),
esc_url( $attachment->image_src_thumb[0] ),
( '' !== $hover_icon ? ' et_pb_inline_icon' : '' ),
$data_icon,
get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true )
);
If you need to be able to display the Description filed as well then right after:
if ( trim($attachment->post_excerpt) ) {
$output .= "
<p class='et_pb_gallery_caption'>
" . wptexturize($attachment->post_excerpt) . "
</p>";
}
Add:
if ( trim($attachment->post_content) ) {
$output .= "
<p class='et_pb_gallery_caption'>
" . wptexturize($attachment->post_content) . "
</p>";
}
a child theme can be dowloaded here: ***a/apps/hrpt54hy/inbox/inbox/478900/conversations/21198389978