为了有一个更好的用户体验,Wordpress默认的用户评论链接是在同一个窗口中打开的,但是对于国内来说,这种链接打开方式可能不太符合国内用户的使用习惯。
所以有些主题已经链接打开方式进行了优化。如果你的Wordpress还没有优化,您可以按照以下方法进行优化。文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
分为两种情况,就看你的博客主题调用那个functions.php文件了。文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
第一种情况:您的博客调用的是wordpress的函数,那么在在wp-includes\comment-template.php中找到如下代码:文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
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);
} 文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
在红色标注的a标签内添加target='_blank'文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
第二种情况:如果你的博客调用的是主题自带的functions.php函数,那请用这种方法:文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
打开主题文件中的functions.php函数,搜索external nofollow,在a标签内添加target='_blank'即可文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
文章源自堕落的鱼-https://www.duoluodeyu.com/657.html
如果你不确定你的博客调用的是那个functions.php函数,你可以两处同时修改了。
1F
不错!很实用!
2F
这个可以考虑改改
3F
能够弹出一个页面,提示要转到另一网站最好了。今天发现一个博客就是这样的。还可以在这个页面放些文章或广告,有可能别人看到感兴趣的文章还会回来,而且有可能点击广告而盈利啊。博主有空设计一些,我想实现这个功能。谢谢了。
B1
@ 王友才 你能不能给我说一下具体是在那个博客看到的?我也去学习一下
4F
看看效果如何?
http://google.com.hk
5F
评论里得链接新窗口打开怎么做?谢谢博主!