• Resolved eveums

    (@eveums)


    Not sure if this is possible or not…

    Currently, when I am adding a link to my post, I am prompted for a URL and then the URL is plopped into my post. I would like for the URL to be plopped into my post ALONG WITH a “target=’new'” or similar code.

    Anyone have any ideas? Thanks!!!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Edit wp-admin/quicktags.js so it will be added automatically. Look for this function near the end of the js file:

    edInsertLink(myField, i, defaultValue)

    In the function change this line:

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

    to:

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

    Thread Starter eveums

    (@eveums)

    Thanks!! ??

    Hey Kafkaesqui,

    I was trying to figure that out too. Just made the edit, but links still do not open in new window. Any other ideas???

    Thanks, Linda

    Linda:

    1. If you edited quicktags.js offline, you uploaded it to the correct directory (wp-admin/)?

    2. If your in the WP edit panel at the time, did you perform a hard-refresh of the page to reload the Quicktags javascript?

    3. You’re using the link Quicktag button to enter links in your post?

    Yes thanks I did all that and double checked it. Plus just tried again after hard refresh. I’m not a coder but your instructions were great and I’m sure I did it right.

    Can you tell anything by looking at my source code?
    https://affiliate-blogs.5staraffiliateprograms.com/

    Thanks so much!

    Nevermind – got it to work! I had only hit refresh before. Had to close my FF browser and then open a new one and it worked. Thanks this is AWESOME!!!

    target=”_new” is deprecated. A better way is to add rel=”external” and then use this code.

    target=”_new” is annoying. A better way is to let your readers decide for themselves whether they want to open a new browser window.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘“hack” so that link will include “target=new”’ is closed to new replies.