Img Alt Attribute Not Appearing in Sourcecode
-
Hi all- I inherited a site with an older theme and I’ve been working on getting its accessibility up to speed. I entered alt text for every image on the site, but it’s not showing up in the sourcecode. I believe this is due to the theme. I looked in functions.php and there’s nothing there that calls to images other than thumbnails. Would I be correct in assuming I need to add a script to functions to force images to show the alt text? PHP is not my forte, and while I can fumble my way through it, I’ve yet to find any options that really make sense for this issue. Below is the only possible option I’ve found so far…but have no clue what the 10 and 2 are for.
Thanks!function isa_add_img_title( $attr, $attachment = null ) { $img_title = trim( strip_tags( $attachment->post_title ) ); $attr['title'] = $img_title; $attr['alt'] = $img_title; return $attr; } add_filter( 'wp_get_attachment_image_attributes','isa_add_img_title', 10, 2 );
The page I need help with: [log in to see the link]
- The topic ‘Img Alt Attribute Not Appearing in Sourcecode’ is closed to new replies.