WordPress.org

Ready to get started?Download WordPress

Forums

How do I make all links in posts (using the "link" button) open a new window? (11 posts)

  1. qpqpqp
    Member
    Posted 5 years ago #

    In WordPress 2.7, how can I make all outgoing links within posts always open a new window? Currently, the "link" command in the body-of-the-post text box creates code that makes links not open a new window, but takes readers away from the current page to the external link page, within the same existing window. To return to continue reading my post, they'd have to click the "back" button, rather than simply close the new window.

    What I mean, specifically, is that I want the "link" command to insert ' target="_blank" ' into the appropriate place in the link code, which would cause a new window to be opened. I could of course do this by hand each time, but I want to be able to use the convenience of the link command.

    How can I change the template/format/whatever in WordPress 2.7 to have this be the case in all postings all the time? (Or does it depend on the theme? I should think not. I'd like it to insert ' target="_blank" ' whatever the theme.)

    I presume I have to change one or more php files and then re-upload them. Which files, and where exactly in those files do I make the changes? Thanks.

  2. Joy Phillip
    Member
    Posted 4 years ago #

    Was this ever solved? I have the same question.

    At one time there was something that you could edit in wp-admin folder to add target="_new" or target="_blank" so that every link you created through the text editor for posts (not the visual editor) would open in a new tab or window. I'd like to have that functionality back.

  3. You can edit your quicktag file to add or modify buttons.

  4. Joy Phillip
    Member
    Posted 4 years ago #

    Okay, I tried editing it, and apparently I don't know what I'm doing since it didn't work at all. Thanks for the help though.

  5. There's a plugin, among others, that handles opening links in new windows.

  6. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    Links that open in new windows without warning the user in clear text should be hung, drawn, quartered and then staked through the heart. I've yet to hear a decent argument for using `target"_blank" across the board.

  7. Everything in moderation, including profile photos which include both bellybuttons and crucifixes :)

  8. Joy Phillip
    Member
    Posted 4 years ago #

    I'm not going to make EVERY link on my site be opened in a new window. If I wanted to do that, I could just put "default link="_blank" in my header statement.

    What I want is for external links to open in a new window, JUST them. The hacks that were recommended above looked to be good and I tried it, but my DB kept crashing when I tried it. I looked over the plugin, and while it's nice, I really want it to be a whole new window (or tab in my case since I'm using FireFox).

    Songdogtech, since you wrote the tutorial for the "new window" and "external link" script, can you help me get it implemented on my site?

  9. I do this for external links and use an arrow gif (like wikipedia) to indicate it's an external link and visually "say" it's a new window. I use this without a plugin, but there is one that does it automagically.

    So, without the plugin, you'll have to still add a class to links, along with a bit of javascript to open a new window (doesn't seem like javascript can differentiate between a new tab and a new window; a new window can be overruled by user settings).

    <a href="http://mydomian.com" class="external" title="link title" onclick="window.open(this.href,'newwin'); return false;">link</a>

    And the CSS is:

    a.external
    {
    background: url(images/external.gif) center right no-repeat;
    padding-right: 13px;
    outline:none;
    border:none;
    }

    The external gif I grabbed from wikipedia, or it can be one you make yourself.

  10. Joy Phillip
    Member
    Posted 4 years ago #

    I do this for external links and use an arrow gif (like wikipedia) to indicate it's an external link and visually "say" it's a new window. I use this without a plugin, but there is one that does it automagically.

    OMG, that did it. It's exactly what I wanted this to do. I wanted my external links to open in a new window (tab) and it does, and I get an icon to denote that it IS a new window IF I WANT IT!!!

    Squeeeeeeeeeeeeeeeeeeeeeeee!!!!!

    I feel like hugging someone!

  11. Well, you can give me a hug, but I think I'm kind of far away, being in Montana.....

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.