How to make comments URL open in new window?

  • Unknown's avatar

    I have all my blog links and photos open in a new window (target=blank), but that command doesn’t work in the comments section. To try to make it work I’ve moved the commenter’s URL into their post with some text like VISIT MY WEBSITE and added the command every way I’ve seen it written (target=blank, target=_blank, target=”blank”) and all that happens is the code adds rel=”nofollow” after the link. I really don’t want any blog links opening in the same window, taking folks away from my blog. Help!

  • Unknown's avatar

    are you not missing the “”?

    target="_blank"

  • Unknown's avatar

    I’ve tried that, too. In my posts, a simple target=blank works, so I’m thinking now that the syntax isn’t the problem.

    Anyone have any idea why this doesn’t work in the comments section? I’m not so much of an HTML geek that I even know what rel=”nofollow” MEANS.

    http://catandcaboodle.wordpress.com

  • Unknown's avatar

    I think it gets stripped in the comments. I’ve not been able to make it work, either.

  • Unknown's avatar

    ah. That would explain it. Will a shortended one also get stripped out? I tried the other day, and it didn’t work.
    :-S
    <a href="blabla>link</a>

  • Unknown's avatar

    I’m glad to know I’m not the only one!
    Waiting for a moderator or Super Geek to supply a more detailed answer, or a way to make this work.

    http://catandcaboodle.wordpress.com

  • Unknown's avatar

    I hate to sound like a cynic, but I fail to see the issue here. Alright, I do, but I don’t think you should be so desperately afraid to loose your readership. A blog isn’t like a store where you can force people to walk all the isles before they reach the check-out. If your blog is more interesting than the link, people usually find the “Back” button on their browser very quickly. Or, there’s always the option to right-click the link and open it in a new window or new tab yourself. I usually do that if the blog I am reading is interesting. I agree that it would add functionality, but I’m not sure it’s a functionality I want.

  • Unknown's avatar

    First of all, the new window link (target=”_blank”) in comments is changed by WordPress.com to “rel=nofollow”, so this looks to be a robot/webcrawler issue. Read that to mean the new window behavior probably won’t get changed.

    Secondly, and this is the blog philosophy-shmilosophy part, your blog it is a part of the INTERnet/INTERweb. In my opinion, that’s what it’s all about. Let it be. Of course, if your commenter is spamming you, certainly delete the offending link if the comment itself is valid.

    Just my inflated 2 cents worth.

  • Unknown's avatar

    Try target=”_new”.

  • Unknown's avatar

    ok,i am posting this here now.. i don’t know if you are people talking about wordpress.com or wordpress as a script generally.
    i found this page while i was searching for the solution.
    however i could solve it myself.

    in the file wp-includes/formatting.php

    find the line :
    function _make_web_ftp_clickable_cb($matches) {

    and

    go 3 lines up and replace this line :

    return $matches[1] . "$url" . $ret;

    with this line :

    return $matches[1] . "$url" . $ret;

    this will add target=”_blank” to all the links in the comments.

    i hope this is helpful some how

    thanks
    Adham

  • Unknown's avatar

    ops.. replace
    return $matches[1] . "$url" . $ret;

    with this

    return $matches[1] . "$url" . $ret;

    sorry again

    Adham

  • Unknown's avatar

    ok.. again the same mistake
    here is the solution at my blog

    http://adhamox.wordpress.com/2008/09/05/a/

  • Unknown's avatar

    adhamox,
    Your code crashed my blog…It’s on it’s own domain, so I don’t know if that is an issue, but no worky.
    Luckily, all I had to do was delete the modded file and restore the original.

    Oh well, perhaps wpvtsp and justjennifer are right. If a blog can’t handle a page change, then perhaps it shouldn’t survive.

  • Unknown's avatar

    adhamox’s solution will NOT work for wordpress.COM blogs as we do not have access to php files. And bpjasper – you are in the wrong forum if you are self hosted. We do not use the same software here so both you and adhamox should be over at http://wordpress.OEG

  • The topic ‘How to make comments URL open in new window?’ is closed to new replies.