当前位置:首页 »“秋了秋”个人博客 » WP教程 » wordpress评论作者网址新窗口打开

wordpress评论作者网址新窗口打开

作者:秋了秋 发表时间:2014年09月09日

由于每次升级都要进行一次设定,有时候总是忘了在什么具体位置修改,现在我把它放在我的博客以便好找。评论作者昵称是带有作者的网址超链接的,让其在新窗口打开很有必要,这也是防止流量流出的措施之一。那为什么程序开发人员不事先设好呢,因为国外习惯在本窗口打开,并且他们认为新窗口打开对访客是不太礼貌的。但这都是国外的一些习惯,所以我们还是根据自己的意愿来修改。

找到:WP-include/comment-template.php 这个文件 然后在:function get_comment_author_link( $comment_ID = 0 ) { /** @todo Only call these functions when they are needed. Include in if… else blocks */ $url = get_comment_author_url( $comment_ID ); $author = get_comment_author( $comment_ID ); 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); } 然后在找到: $return = "<a href='$url' rel='external nofollow' class='url' >$author</a>"; return apply_filters('get_comment_author_link', $return); } 加一个target='_blank',变成 $return = "<a href='$url' rel='external nofollow' class='url' target='_blank'>$author</a>"; return apply_filters('get_comment_author_link', $return);

0
文章作者: “秋了秋”个人博客,本站鼓励原创。
转载请注明本文地址:http://netblog.cn/blog/120.html
目录: WP教程标签: wordpress,新窗口打开,评论作者 12394次阅读

请求播放音乐,请点击播放

登 录
点击获取验证码
还没账号?点击这里