评论者链接在新窗口打开

根据昨日fghwett兄建议,近日修改了评论中评论者的网站地址新窗口打开。

First,在wp-include找到comment-template.php。

Second,在其中找到如下代码:大概在219行开始

function get_comment_author_link( $comment_ID = 0 ) {
	$comment = get_comment( $comment_ID );
	$url     = get_comment_author_url( $comment );
	$author  = get_comment_author( $comment );

	if ( empty( $url ) || 'http://' === $url ) {
		$return = $author;
	} else {
		$return = "<a href='$url' rel='external nofollow ugc' class='url'>$author</a>";
	}

就看最后一行,添加一小段属性就好,target=’_blank’ 最后的结果就是这样的。

$return = "<a href='$url' target='_blank'  rel='external nofollow ugc' class='url'>$author</a>";

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code