Add “alt” Attribute to GD Star Rating Tags

Add the attribute to each line of code that creates an img tag. In your text editor, search for lines that contain the string "<img".

Lines 241 and 273:

$row->item_trend_rating = sprintf('<img class="trend" src="https://wordpress.stackexchange.com/questions/96226/%s" style="https://wordpress.stackexchange.com/questions/96226/%s" width="https://wordpress.stackexchange.com/questions/96226/%s" height="https://wordpress.stackexchange.com/questions/96226/%s"></img>', $gdsr->e, $image_bg, $set_rating->size, $set_rating->size);

Becomes:

$row->item_trend_rating = sprintf('<img class="trend" src="https://wordpress.stackexchange.com/questions/96226/%s" style="https://wordpress.stackexchange.com/questions/96226/%s" width="https://wordpress.stackexchange.com/questions/96226/%s" height="https://wordpress.stackexchange.com/questions/96226/%s" alt="https://wordpress.stackexchange.com/questions/96226/%s"></img>', $gdsr->e, $image_bg, $set_rating->size, $set_rating->size, 'ALT TEXT HERE' );

Change ALT TEXT HERE to the text you want to use here.

Line 503:

$rater_stars="<img src="".STARRATING_URL.sprintf("gfx.php?type=thumbs&value=%s", $score).'" />';

Becomes:

$rater_stars="<img src="".STARRATING_URL.sprintf("gfx.php?type=thumbs&value=%s", $score) . '" alt="' . $score . '" />';

Lines 506 and 511:

$rater_stars="<img src="".STARRATING_URL.sprintf("gfx.php?value=%s", $rating).'" />';

Becomes:

$rater_stars="<img src="".STARRATING_URL.sprintf("gfx.php?value=%s", $rating) . '" alt="' . $rating . '" />';

I used $rating as the alt text because it looks like a string. Feel free to change it.