Alt tag to Header

Community Forums Forums Design Tips and Tricks Alt tag to Header

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  braddalton 2 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #48478


    I have the sample child theme. My SEO software is saying I don’t have an alt tag on my header image. I was told by customer service to go to settings>general and I filled out the tagline but that isn’t helping. I have WordPress SEO by Yoast. Can someone please help me add an alt tag to my header? The sample child theme has no header.php.



    Can you link to your site please.

    How did you add the header image to the theme?

    You can add the alt text using a custom function:

    function add_header_genesis() {
        echo &#8216;&lt;div class=&quot;add-header&quot;&gt;<a href="&quot;//;"><img alt="&quot;wp-sites-logo&quot;" src="&quot;&quot;//;" width="&quot;1152&quot;" height="&quot;69&quot;" /></a>&lt;/div&gt;';
    add_action(&#8216;genesis_header&#8217;, &#8216;add_header_genesis&#8217;);

    You can see the image alt in this HTML:

    img alt="wp-sites-logo" 

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.