Viewing 4 replies - 1 through 4 (of 4 total)
  • Yes, that looks right. Have you inspected the source code of your pages, to see if the images do in fact have alt attributes? Can you post a link to a page with an image on it?

    Thread Starter munyez33

    (@munyez33)

    I see alt attributes on the images inside your post content.

    I think the issue is only for the post thumbnails (main top image and thumbnails in the sidebar). These are the images you uploaded on the “Featured Image” section on each post.

    You need to find the code that outputs these images (something like the_post_thumbnail()) and change it to something like:

    $$image_id = get_post_thumbnail_id($post->ID); // Get the image ID
    $image_url = wp_get_attachment_image_src($image_id); // Get the image URL
    $alt_text = get_post_meta($image_id , '_wp_attachment_image_alt', true); // Get the Alternative Text

    You can then use it like this:

    <img src="<?php echo $image_url; ?>" alt="<?php echo $alt_text; ?>" />

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Please contact your theme author about this, it’s not fair to ask support for commercial products here.

    Alternatively use a theme we support: http://wordpress.org/themes/

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problem with writing ALT TAGs’ is closed to new replies.