I’m just getting this blog all setup today and noticed really quickly that the theme I’m using is missing some basic accessibility features. For example, the blog header doesn’t insert the alt text I have set in the meta data for the WordPress media object.
Having found that in the first place I looked probably means there are a bunch of other problems too. I tried to fix it really quick but my WordPress PHP skills weren’t good enough so I’ll have to revisit this. I’ll post some updates as I work on it and try to submit the fixes upstream to the theme maintainers.
You can see here that it doesn’t even try right now:
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" class="header-image" /></a>
I just have to figure out how to fetch the alt text to put in that empty alt=""
. It should be pretty easy.
Note to self:
$alt_text = get_post_meta($img_id , '_wp_attachment_image_alt', true);