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 9 months, 3 weeks ago.

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

    heathermiller
    Participant
    Post count: 1

    Hi
    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.

    #48489

    braddalton
    Participant
    Post count: 7458

    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 '<div class="add-header"><a href=""//yourdomain.com""><img alt=""wp-sites-logo"" src="""//yourdomain.com/wp-content/uploads/2013/06/wp-sites-logo.png"" width=""1152"" height=""69"" /></a></div>';
    };
    add_action('genesis_header', 'add_header_genesis');
    

    You can see the image alt in this HTML:

    img alt="wp-sites-logo" 
    

    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

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

You must be logged in to reply to this topic.