Restore alt attribute text to image gallery
-
Suggestion if an update every becomes available to implement this, but for everyone else who wants to know how to restore alt attributes, here it is. This ONLY restores it on the tiled gallery, not on the actual carousel image. I’ll get to that eventually. ??
Edit the plugin.
Edit tiled-gallery.php
Under line 259 ($image_title) add:
$image_alt = get_post_meta($image->ID, '_wp_attachment_image_alt', true);
Then add around like 265…
alt="' . esc_attr( $image_alt ) . '" />
To the output.
Should look like:
$output .= '<div class="tiled-gallery-item tiled-gallery-item-' . esc_attr( $size ) . '"><a href="' . esc_url( $link ) . '"><img ' . $this->generate_carousel_image_args( $image ) . ' src="' . esc_url( $img_src['url'] ) . '" width="' . esc_attr( $image->width ) . '" height="' . esc_attr( $image->height ) . '" align="left" title="' . esc_attr( $image_title ) . '" alt="' . esc_attr( $image_alt ) . '" /></a>';
- The topic ‘Restore alt attribute text to image gallery’ is closed to new replies.