• This modification allows my wordpress to prompt me for the title attribute when I use the quicktags in the post page to add a link.
    Here is what I have in my wp-admin/quicktags.js file, closer to the bottom:

    function edInsertLink(myField, i, defaultValue) {
    if (!defaultValue) {
    defaultValue = 'https://';
    }
    if (!edCheckOpenTags(i)) {
    var URL = prompt('Enter the URL' ,defaultValue);
    if (URL) {
    edButtons[i].tagStart = '< a href=""'<br" />
    + URL
    + '" title="' + prompt('Enter a title for the link', '')
    + '">';
    edInsertTag(myField, i);
    }
    }
    else {
    edInsertTag(myField, i);
    }
    }

    This function replaces the existent edInsertLink(); function in the quicktags.js file

Viewing 6 replies - 1 through 6 (of 6 total)
  • I was just going to ask for help on getting this feature. Thanks!

    Works 100% perfect.

    Make sure this gets to Matt as it should be added to quicktags.

    yes it does work, but not as written here. Word press has deleted the <a href=” part and turned it into a link which should be obvious from the fact that everything after that in the post is blue and underlined.

    The correct line should be:
    edButtons[i].tagStart = ‘<a href=”

    Someone should edit the post above and change < to &lt; in case anyone else tries to copy the code.

    Yes this would be good in the official release quicktags, but maybe the JavaScript needs another if/else in case there is no title to stop it writing title=”null”

    cheers

    @drstuey – thanks, I have edited the above code.

    Note: Remove this space:

    < a href=

    <a href=

    I’ve copy and pasted over the code, and for some reason still cant do it. Is there something special i have to do?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Getting WP to prompt you for the “title” of link’ is closed to new replies.