• I like this theme and have been using it for about two years or so. I host my images using Picasa Web gallery and insert link to image into post. Unfortunately, there was always a problem with image’s ALT attribute, every time I use ALT the image the preview won’t show up on front page. This was because of the way the image was pulled from post source – the URL was concatenated with sanitized ALT along with width and height attributes. So, instead of https://example.com/images/abc.jpg you would get https://example.com/images/abc.jpgAltAttributeHereWidht500Height300 – which is exactly why front page preview was broken.

    If you care to fix this, you need to dig into theme’s functions file (functions.php) and locate function the_post_image_url($size=large). Inside it, find the following lines:

    } elseif ( $linkedimgurl ) {
    		echo $linkedimgurl;

    replace the second line (echo… ) with the following:

    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    $first_img = $matches [1] [0];
    echo $first_img;

    This fixed things for me. You can see it working on https://zealusmedia.com

  • The topic ‘Problem with ALT attribute’ is closed to new replies.