Want image captions to be from img ALT tags not title tags

You’re in the right file, shutter-reloaded is where you’ll want to make the change.

It looks like the gallery plugin is parsing the entire document for its links to start. That function is called init on line 34. Inside that function, the plugin is going to loop through all the links on the page and determine if it’s a valid gallery thumbnail.

The line you’re interested in is going to be line 61. The plugin is inspecting the title attribute of the link to determine if it should use it, and then it’ll assign it to the variable T.

If you replace line 61 with the following 2 lines of code, it should work.

var linkAlt = jQuery(L).attr('alt');
T = ( linkAlt && linkAlt != shfile ) ? linkAlt : '';

Those lines will get the alt text content, assign it to a variable named linkAlt, and then continue with the plugin’s original logic of making sure it’s not the same as the filename (for some reason).

[edit]

Also, just keep in mind that if you change the source code of a plugin you’ll lose those changes if you update it.

Leave a Comment