This is not the default behavior of WordPress…. You’d have to hack into the core to change it.
In wp-includes/comment-functions.php, find:
function get_comment_author_link() {
global $comment;
$url = get_comment_author_url();
$author = get_comment_author();
if ( empty( $url ) )
$return = $author;
else
$return = "<a href='$url' rel='external nofollow'>$author</a>";
return apply_filters('get_comment_author_link', $return);
}
Change the return line to:
$return = "<a href='$url' rel='external' target='_blank'>$author</a>";
Note that the target attribute is not valid XHTML 1.0 Strict, but its up to you if you care about that.
Instead of target="_blank" you can use onclick="window.open(this.href);return false;" – works just fine.
Sorry, I learned HTML before all this fancy script stuff 🙂
*laughing* S’okay, not really a script, just a different way to do the whole “open elsewhere” thingy. What I posted above is used, for instance, like this: <a href="http://example.com/index.php" onclick="window.open(this.href);return false;"> – basic html addy that opens a new window.
I don’t see any reason it wouldn’t work for the href in the $return call, though of course, I could easily be wrong. (I quite frequently am!)
Could someone do it for me please?
Shit i just buggered it up. It doesen’t say who commented now, it just says Says:
Please help..
[Moderated – huge code chunk deleted]
Sorry been studying for final exams.
Here is the version that works for me (WP 1.5 only)
Save this as comment-functions.php, and put it in your /wp-includes/ directory. Should be all set after that.
is these for the comments post body enter http://fghhh.com/ then click on link while viewing comment in blog open in new windows?
Any moderators around to delete all that code above?
It worked ! Thank you so much!