Support » Plugin: Ultimate Posts Widget » Change Thumbnail ALT tag

  • Resolved GenericBox

    (@genericbox)


    Hi there,

    I am using your plugin on a build that I’m trying to get to WCAG 2.0 AA compliance, however the ALT tag of thumbnails used in the widget are not pulling the designated ALT set in the media library, and instead are using the Post title.

    This fails WCAG 2.0 AA as the ALT tags of images need to be descriptive of the image content.

    You just need to add one more line to Line 160:

    $thumb_alt = get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true);

    Then, in the following IMG tag on Line 166, I changed the alt= attribute to:

    if(count($thumb_alt)){ echo $thumb_alt; } else{ the_title_attribute();}

    Which will display the ALT tag from the Media Library if it exists, but revert back to the Post title if it doesn’t.

    Would this be able to be introduced into an official release so this change isn’t removed in an update?

    Thanks,
    GB.

    http://wordpress.org/plugins/ultimate-posts-widget/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Thumbnail ALT tag’ is closed to new replies.