Okay,here’s my challenge. My client doesn’t like how when you roll over an image in the gallery a tooltip shows up with the image’s descritpion, which is taken from it’s title tag. But he still wants the image description to show up as the caption when you click on the image and enlarge it.
Here is a link to a page in the site, if you roll over the first image in the gallery, you’ll see what I’m talking about and hopefully it’ll make sense. http://mbigelowphotographer.com/wp/engagements
I’ve tried to find ways on hiding browser default tooltips but I’ve had no luck. So I thought of placing the image’s description in the images alt tag instead of the title tag. Which is fine, I took care of that in the gallery.php file.
But now I can’t figure out where in the shutter-reloaded.js, for the image caption to pull the alt tag instead of the title tag. I’m hoping its a simple solution that I’m just overlooking since I am only vaguely familiar with javascript.
Or maybe I’m way off and it’s not in that js file. Any help would be appreciated. Thanks in advance.
I am sure I’m being vague in my description here, don’t hesitate to ask for more details.
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.
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.
Jared Cobb’s solution relies on jquery. You can do without by instead using