January 23, 2017 at 5:56 am #25572
I’ve noticed that the featured images in my posts don’t have any alt tags in the code, even though the featured image in the WordPress Media Library does have an alt tag.
This post is a good example:
If you look at the page source, all the images have an alt tag but the Featured Image just has :
class="featured thumbnail full wp-post-image" alt="" title=""
whereas the exact same image later in the post has:
Is there anything I can do to fix this?
Adam.January 23, 2017 at 12:53 pm #25583
This is a bug that needs fix. Have fixed the same in my dev and will include the same in the next update.
Pls change the line number 196 of framework/functions/thumbnail-functions.php file from –
$atts = array( 'class' => $image_class, 'alt' => $image_alt, 'title' => $image_title );
$atts = array(); if (!empty($image_class)) $atts['class'] = $image_class; if (!empty($image_alt)) $atts['alt'] = $image_alt;
and the issue should be fixed. Again, this change will be part of next update and hence you won’t need to redo this if you update the theme.January 24, 2017 at 6:06 pm #25600
That totally worked! Thank you so much.
Unfortunately, it’s either highlighted or created another problem. On the main page of my website, I have a little blog preview section which puts in a same featured images and the first sentence or two. Now those featured images are missing their alt tag.
So instead of lache.png missing the alt tag it’s now Lache.png?resize=500%2C343 missing the alt tag.
If you go to http://www.aussieninjawarrior.com.au it’s all the images in the ‘From the Blog’ section that are affected.
Is there another bit of code I can add?
Adam.January 26, 2017 at 5:05 am #25614VeenaModerator
Will get back to you on this shortly.January 28, 2017 at 5:00 pm #25622
Thanks phoenix, I really appreciate it.January 30, 2017 at 1:51 pm #25623
I am sorry – I do not see any issues. The ‘From the Blog’ section posts do have the right alt text on their featured images – the same alt tag text that shows up in the individual single blog posts. Can you double check once again and get back to me if I am missing something here? I checked our dev site as well which has the same Blog section in one of the home pages and saw no issues there too.January 30, 2017 at 7:35 pm #25625
No Meteorite, I’m sorry. I’ve just rechecked, and all my images have alt tags now. I’m not sure what changed, I honestly haven’t touched any code or anything since I incorporated those initial changes you suggested. I’m sure I was missing alt tags, but I’m not now so I’m sorry if I’ve wasted anyone’s time and you can close this ticket now.
Thanks you both so much for your support. I really appreciate it.January 31, 2017 at 12:00 pm #25627
No problem. Probably a caching issue and things took time to reflect the changes done on the backend.
- The topic ‘Featured Image in a post has no alt tag’ is closed to new replies.