WordPress.org

Ready to get started?Download WordPress

Forums

how to get rel="external" in WP2 link quicktag (5 posts)

  1. nickel
    Member
    Posted 8 years ago #

    Hi all,

    I'm trying to modify WP2 to insert rel="external" when I use the link quicktag. I had previously done this in 1.5.X and it worked fine. Just had to hack quicktags.js. Once I found quicktags.js in WP2 (it's moved from wp-admin to wp-includes/js) I applied the same hack and it has no effect. Here's what I did.

    Changed:

    edButtons[i].tagStart = '<a href="' + URL + '">';

    to

    edButtons[i].tagStart = '<a href="' + URL + '" rel="external">';

    But, as I said, it hasn't had any effect.

    Please help!

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    Are you using the editor without the new wysiwyg bar ?
    If so, you can just put your old .js file where the new one is and it should work.
    (Caveat - if you have added any tags that use internal relative urls they will break)

  3. nickel
    Member
    Posted 8 years ago #

    Great suggestion, and yes, I'm using the old-style editor as opposed to the WYSIWYG editor. Unfortunately, it still doesn't work, even with the old quicktags.js file transferred over. Grrr... Anyone have any other suggestions? This is really frustrating!

  4. Mark (podz)
    Support Maven
    Posted 8 years ago #

    Odd...
    I just put an old quicktags.js of mine (1.5.2) into this 2.0 install:
    http://www.tamba2.org.uk/wordpress/TestTrack/wp-admin/post.php
    and it uses the target="_blank" attribute when the 'newlink' button is clicked.
    That button was written using this:
    http://www.tamba2.org.uk/wordpress/newwintag/
    so that should work for what you need ?

  5. nickel
    Member
    Posted 8 years ago #

    Okay, I got it working -- I couldn't get the new button thingy to work, but I was able to steal a line of code from that and replace the line in question in my quicktags file.

    So I replaced line 371 with this:

    edButtons[i].tagStart = '<a href="' + URL + '" target="_blank">';

    and then tweaked it to look like this:

    edButtons[i].tagStart = '<a href="' + URL + '" rel="external">';

    Which look EXACTLY (I think) the same as what I did above. But, for some reason, cutting and pasting from your code made it work (?).

    As far as the button goes, when I made the changes as instructed on the site that you referenced, none of my quicktag buttons loaded. So I clearly screwed something up. A couple of questions... I am supposed to *add* those lines, right? And not *replace* them? Assuming that I add them, I then end up changing the lines downstream (once I add lines 60-66, the line numbers below shift). So are the later changes referring to the original line numbers, or to those after the changes above have been made?

    It would be handy to have another button for this, as I don't want every link to spawn a new window. So right now I have to hand edit out the rel="external" from those that I want to stay within the current window. Not a big deal, but not overly slick.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags