Closed nickcernis closed 6 years ago
@NicktheGeek Yes, as things stand a blank alt attribute would be used if genesis_get_image()
gives the fallback image (because get_post_thumbnail_id will give an empty string).
I'd like to contribute sensible default alt attributes to genesis_get_image in Genesis itself so that fetching the alt meta isn't required for child themes and plugins. For now I think having a blank alt tag on fallback images is fine. The alternatives I considered were:
Run genesis_get_image
twice — once to get the URL of the image or fallback image (with format => url
), and again to get the fully-formed markup with the alt tag for the given image URL (via attachment_url_to_post_id
and then get_post_meta
on the attachment ID).
Use the_post_thumbnail
instead of genesis_get_image (which is not how other archives work and won't give the fallback image, so may break what people are used to).
It wasn't clear that either of those are better than what's there now, but I'm open to suggestions and ideas.
I think the ideal scenario is that alt tags are added in Genesis. I've opened this to discuss further: https://github.com/studiopress/genesis/issues/1934
This changes the alt attribute to use alt meta from the image, instead of the post title.
This prevents the title repeating, and allows custom alt text to be different than the portfolio item title.
@marksabbath Please could you double check this when you get a moment? Thanks!