I have only just discovered the problems associated with different browsers handling of the “alt” and “title” attribute of an “img” element (see http://virtuelvis.com/gallery/alttext for example).
In one of my WordPress sites http://scrumble.com.au I have over 650 images within the posts content. They appear like this:
<img src=”/images/someimage.jpg”alt=”some text”/>
I want compliant browsers like Firefox to display the value of the alt attribute as a tooltip on mouse-over. Now I understand the difference between alt and title I will get it right for all new posts. However I wish to address the problem with all the existing images.
One way I can achieve this is to change them all to read like this:
<img src=”/images/someimage.jpg”alt=”some text”title=”some text”/>
I am trying to work out the best way to achieve this. Has anyone encountered a similar problem before?
Am I correct in my understanding that the string manipulation required would make this too complex to address using the replace and update syntax of mySQL? Would I be best to export the wp_posts table of the database and perform some sort of string manipulation in an editor before importing it back? Or is there some existing php code (plugins, hacks) that I could use to interact directly with the database?
I’ll keep working on the problem, but in the meantime I would really appreciate any advice from anyone with similar prior experience.
- The topic ‘Adding a title attribute to all existing images in a blog’ is closed to new replies.