WordPress.org

Forums

empty alt-tags in galleries (2 posts)

  1. carsten_lin
    Member
    Posted 7 years ago #

    Hi,

    I use the new gallery function very often on my blog and I noticed that the alt-tags at the thumbnails and the medium sized pictures are empty, although I filled in the form.
    I already tried the gallery cleaner plug-in but it is not solving the problem.

    Does somebody knows a solution?

    Thank you,
    Carsten

  2. carsten_lin
    Member
    Posted 7 years ago #

    I just checked the media.php in the includes directory.

    // as per wp_get_attachment_image_src, but returns an <img> tag
    function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = false) {
    
    	$html = '';
    	$image = wp_get_attachment_image_src($attachment_id, $size, $icon);
    	if ( $image ) {
    		list($src, $width, $height) = $image;
    		$hwstring = image_hwstring($width, $height);
    		if ( is_array($size) )
    			$size = join('x', $size);
    		$html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="'.attribute_escape($alt).'" />';
    
             }
    
    	return $html;
    }

    it seems to be ok, the alt-attribute should be inserted.
    I hope you understand what I mean. Here is a example of my site: http://www.halle-fotos.de/innenstadt/bilder-rund-ums-fahnenmonument-am-hansering/attachment/parkanlage/

Topic Closed

This topic has been closed to new replies.

About this Topic