网赚论坛

 找回密码
 免费注册
查看: 222|回复: 0
打印 上一主题 下一主题

wordpress评论中如何加nofollow标签

[复制链接]

16

主题

16

帖子

64

积分

Ⅰ级财主

Rank: 1

积分
64
跳转到指定楼层
楼主
发表于 2017-9-25 16:54:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
朋友问我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文件打开。找到以下代码:

  • $return = “$author”;


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

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

广告合作|Archiver|手机版|小黑屋|财富吧

GMT+8, 2026-7-25 21:09 , Processed in 0.390001 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.1

© 2014-2021 财富吧

快速回复 返回顶部 返回列表