• My SEO tools are yelling at me for not having an ALT tag for my header image.

    There doesn’t seem to be a way to dynamically add this. Is there some way I can do it besides hardcoding it into the theme?

Viewing 12 replies - 1 through 12 (of 12 total)
  • In the header.php file you could do something like this on line 94 to use the site tagline as the alt tag:

    alt="<?php bloginfo( 'description' ); ?>" />

    Alternatively you could run a query for an attachment you have uploaded and use it’s description. There’s no way ‘as is’ to include an alt for the header images… which is quite an oversight by the theme developers.

    Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.

    For this reason, it is recommended that you consider creating a child theme for your customisations. Once your child theme is active, we should be able to help with the customisation.

    That said your SEO tool is wrong (which is understandable – it is only a dumb tool). You do not need – nor should you add – alt text to the header image in Twenty Eleven.

    Theme editing issues aside, alt text is still important for accessibility.
    I’m surprised there’s no way of adding it, even if it’s left optional.

    Agreed but the header image in Twenty Eleven has absolutely no semantic context. It’s a purely decorative image, so should only ever have a null alt text (alt=””).

    Thread Starter adyo

    (@adyo)

    Just as a note, I am using child themes since the concern came up.

    No alt tag really stinks. Thanks for the tips above, seems a bit too involved for what I’m trying to do but something to think about.

    No alt tag really stinks.

    Why? The alt attribute isn’t there for you to keyword-stuff it. It has one use and one use only – to provide a text equivalent for any informational image so that the this info can be accessed by non-graphic user agents.

    Thread Starter adyo

    (@adyo)

    Why? The alt attribute isn’t there for you to keyword-stuff it. It has one use and one use only – to provide a text equivalent for any informational image so that the this info can be accessed by non-graphic user agents.

    For one, you answered your own question.
    It’s also helpful for SEO reasons.

    It’s not there for SEO and it’s weighting is pretty low anyway. As I said, it isn’t there for you to keyword-stuff it.

    But for cases where there is a semantic context (e.g. in a custom child theme) it would be useful if it wasn’t hard-coded as alt=""

    hi.
    i want to add alt tag to header image in twenty-eleven theme.
    how can i do that?

    thanks

    Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.

    Create a child theme for your changes. Once your child theme is active, we should be able to help with the customisation.

    And next time, post a new topic…

    Are we saying (as to whether you should/should not/need/need not do this) that there is no way of doing this then?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Theme: Twenty Eleven] Adding ALT tag to header image’ is closed to new replies.