新窗口打开评论留言链接
前一段时间有朋友问我怎么让评论部分的链接在新窗口打开,我以前还真没有注意过这个问题。我们应该尽一切方法对用户展示我们的博客,使博客能很大程度增加曝光度,别人在通过新窗口打开新的链接,而原来的网页并没有关掉,也许读者不会立即关掉,可能会再寻找一些他们需要的东西,这样就增加了博客的PV。
于是我在网上找了几个方法与大家一起分享:
首先在你的安装目录下面找到wp-includes/comment-template.php文件,搜索下get_comment_author,你会看到function get_comment_author_link() 这个函数,然后将$return = “<a href=’$url’ rel=’external nofollow’ class=’url’>$author</a>”;修改为$return = “<a href=’$url’ rel=’external nofollow’ class=’url’ target=’_blank’ >$author</a>”这样就OK啦,打开评论者链接试试吧!
这个方法修改的是wordpress程序,所以在程序升级以后就不能用了,需要再次修改。网上还有别的方法,我自己感觉还是这个比较简单,其余的是增加js脚本调用的,如果朋友们不喜欢这个方法,可以去搜索其他的方法哦!
注意:修改代码之前最后备份哦,以免出现问题;再就是在修改代码的时候要仔细寻找,确定找到的是正确的位置,改的时候注意引号之类的不要忘记!
下一篇: 这是第101篇日志


2012/02/17 20:35:44
不错不错,谢谢分享!
2011/10/14 10:56:39
看了我也觉得不错
2011/08/26 01:25:50
Best Cinema…
If you need a great review about cinemas check out this site….
2011/08/19 09:37:27
pandora jewelry pandora sale uk thomas sabo barcklets shop buy cheap online oakley sunglasses charmsi love travelling and listening to the musici love travelling and listening to the musicthanks for sharing such informative and fantastic post..
2011/08/19 09:36:45
thanks for sharing such informative and fantastic post..i love travelling and listening to the musicthanks for sharing such informative and fantastic post..
2011/08/19 09:36:12
pandora jewelry pandora sale uk thomas sabo barcklets shop buy cheap online oakley sunglasses charmsi love travelling and listening to the musici love travelling and listening to the music
2011/08/19 09:35:21
thanks for sharing such informative and fantastic post..i love travelling and listening to the music
2011/08/19 09:34:57
pandora jewelry pandora sale uk thomas sabo barcklets shop buy cheap online oakley sunglasses charmsthanks for sharing such informative and fantastic post..i love travelling and listening to the music
2011/08/19 09:34:03
pandora jewelry pandora sale uk thomas sabo barcklets shop buy cheap online oakley sunglasses charms
2011/08/19 09:33:25
thanks for sharing such informative and fantastic post..
2011/07/30 22:48:17
Amazing site check it out!…
Found this amazing site which has relation with this one, check it out and tell me what you think!? Please reply asap…
2011/07/16 14:43:57
I read with great interest.Thanks for you sharing.
2011/07/16 14:43:35
Have a fantastic vacation!
2011/06/01 10:14:43
Your article write very well.
2011/05/28 10:18:43
很好
2010/10/03 07:06:50
http://www.xiaojie.me也是个人网站吧?没来您这看之前,我还认为我的站做的不错呢,惭愧啊...
2010/10/03 20:25:17
你的站也不错啊,呵呵相互交流,共同进步吧
2010/09/16 00:16:23
PHP高手真不少
2010/09/16 07:47:43
我也是只会点皮毛,这个方法不是我的原创,呵呵
2010/09/16 00:05:42
很实用,可以参考
2010/09/16 00:04:33
细节很重要
2010/09/14 16:23:00
简单也不简单!就是看自己怎么理解啦!
2010/09/14 15:20:00
是的 这个不难的!
2010/09/13 23:20:10
哈哈..这个问题是我问的啦….已经改好了….
2010/09/13 21:02:31
最简单易懂的方法了,收藏了!
2010/09/13 23:09:47
我也是认为这个方法比较简单了,呵呵
2010/09/13 19:44:33
暂时还没处理到这个细节~
2010/09/13 23:06:00
很值得这样去做的哦
2010/09/12 23:48:59
这种方法很简单,不错。核心在于”target=’_blank’ “
2010/09/13 09:24:39
说的对啊,这就是关键之处
2010/09/12 23:35:30
改好了!
2010/09/12 23:28:58
谢谢!这个好!
2010/09/12 21:43:33
小杰,为什么我的comment-template.php文件里面,找不到你说的那些函数??
2010/09/12 22:38:08
不可能的啊,只要你的是wp程序就肯定有的啊,你用搜索试试,自己慢慢找,容易漏掉
2010/09/12 23:34:53
我把函数贴给你看,真没有.
<li id=”comment-”>
<div id="comment-div-” class=”comment-container”>
<div class="comment “>
at
comment_approved == ’0′) : ?>
Your comment is awaiting moderation.
NULL, ‘depth’ => $depth, ‘max_depth’ => $args['max_depth']))) ?>
2010/09/12 20:28:56
不过我觉得有些人不喜欢这种方式。
2010/09/12 22:36:49
我感觉这个方法是比较简单的啦,呵呵
2010/09/12 17:38:13
嗯,回头试试看
2010/09/12 22:38:41
嗯,这个方法还是不错的哦,试试吧