网赚论坛

标题: wordpress评论中如何加nofollow标签 [打印本页]

作者: hnh87448kja    时间: 2017-9-25 16:54
标题: wordpress评论中如何加nofollow标签
朋友问我wordpress留言版块的评论链接和昵称链接如何实现新窗口打开,还有给wp的评论链接加上nofollow。wordpress默认的是在本站打开,在WordPress评论中,会留下留言者的网址超链接,直接点击就会离开当前的页面,直接造成页面流量丢失,从而提高了网站的跳出率。让评论也像wp网站标题一样新窗口打开,这一点不仅仅对seo不利,而且也不符合用户体验。下面我们分别来说下wordpress评论链接新窗口打开和加nofollow。wordpress实现评论链接新窗口打开
代码见:
找到:WP-include/comment-template.php 这个文件
然后在:function get_comment_author_link( $comment_ID = 0 ) {
/** @todo Only call these functi** 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 = “$author”;
return apply_filters(‘get_comment_author_link’, $return);
}
然后在找到:
$return = “$author”;
return apply_filters(‘get_comment_author_link’, $return);
}
加一个target=’_blank’
$return = “$author”;
return apply_filters(‘get_comment_author_link’, $return);
文字说明如下:
首页打开wp-includes文件夹,找到comment-template.php文件打开。找到以下代码:


<div align="left">在[url=]标签中插入一句[target="_blank"]尖括号中的内容,然后保存。这样,访客昵称所指向的链接就会在新窗口打开了。[/url]




欢迎光临 网赚论坛 (http://www.caifuba.net/) Powered by Discuz! X3.1