为了便于不使用户及时离开我们的博客,wordpress默认的评论链接是在同一窗口中打开的,不知道是开发程序的人是故意这样的还是忽略了这一点,下面说给大家说下修改wordpress评论链接在新窗口中打开的方法。

如果你的博客主题调用的是wordpress函数,那么在wp-includes\comment-template.php中找到如何代码:

function get_comment_author_link() { 
/** @todo Only call these functions when they are needed. Include in if... else blocks */
$url    = get_comment_author_url(); 
$author = get_comment_author(); 
if ( empty( $url ) || 'http://' == $url ) 
$return = $author; 
else
 $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>"; 
 return apply_filters('get_comment_author_link', $return); 
}

在a标签处添加target='_blank'即可。

如果是调用的博客主题函数,那么找到你主题下的functions.php文件,搜索external nofollow,在a标签处添加target='_blank'即可。

在不确定的情况下,干脆把两处都修改下得了。


原创文章如转载,请注明:转载自蛐蛐工作室
原文地址:http://www.qqgzs.com/archives/368.html