WordPress quicktag toolbar tweaking again

Date November 10, 2007

It is said that it is a good behavior to set title attribute to a tags. I usually put to the title the text of the link. The process is: I put the link to the clipboard, go to the editor, select the text, press Ctrl-A, insert the link to the dialog box, press enter, then put the text of the link to the clipboard, go to the opening a tag, insert title="" and finally paste the text from the clipboard to the attribute. This is a repetitive and tedious task, so like in the previous case I automate it.

To get WordPress to insert the title attribute automatically to a tag we had to modify the wp-includes/js/quicktags.js file by adding a few lines of code to the edInsertTag function at two places:

if (edButtons[i].id == 'ed_link') {
    edButtons[i].tagStart = edButtons[i].tagStart.replace(/>/, ' title=&qout;'+selectedText+'&qout;>');
if (edButtons[i].id == 'ed_link') {
    edButtons[i].tagStart = edButtons[i].tagStart.replace(/>/, ' title=&qout;'+selectedText+'&qout;>');

You can download the fully modified version from here (this file contains my former modifications).

One Response to “WordPress quicktag toolbar tweaking again”

  1. WordPress quicktag toolbar tweaking again said:

    [...] WordPress quicktag toolbar tweaking again | Gergely Hodicska Uncategorized [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>