WordPress quicktag toolbar tweaking again
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:
341 342 343 | if (edButtons[i].id == 'ed_link') { edButtons[i].tagStart = edButtons[i].tagStart.replace(/>/, ' title=&qout;'+selectedText+'&qout;>'); } |
357 358 359 | 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).
Posted in
content rss

March 24th, 2008 at 12:51 am
[...] WordPress quicktag toolbar tweaking again | Gergely Hodicska Uncategorized [...]