新窗口打开评论留言链接

时间: 2010-09-12 / 分类: 博客相关 / 浏览次数: 4,263 次 / 44 个评论 发表评论

前一段时间有朋友问我怎么让评论部分的链接在新窗口打开,我以前还真没有注意过这个问题。我们应该尽一切方法对用户展示我们的博客,使博客能很大程度增加曝光度,别人在通过新窗口打开新的链接,而原来的网页并没有关掉,也许读者不会立即关掉,可能会再寻找一些他们需要的东西,这样就增加了博客的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脚本调用的,如果朋友们不喜欢这个方法,可以去搜索其他的方法哦!

注意:修改代码之前最后备份哦,以免出现问题;再就是在修改代码的时候要仔细寻找,确定找到的是正确的位置,改的时候注意引号之类的不要忘记!

填写您的邮件地址,订阅我们的精彩内容:

44个评论

  1. booklet printing
    2012/02/17 20:35:44

    不错不错,谢谢分享!

  2. renlewei
    2011/10/14 10:56:39

    看了我也觉得不错

  3. Best Cinema
    2011/08/26 01:25:50

    Best Cinema…

    If you need a great review about cinemas check out this site….

  4. sports jerseys
    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..

  5. sports jerseys
    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..

  6. juicy couture watches
    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

  7. Pandora Jewelry
    2011/08/19 09:35:21

    thanks for sharing such informative and fantastic post..i love travelling and listening to the music

  8. Thomas Sabo UK
    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

  9. Pandora jewellery
    2011/08/19 09:34:03

    pandora jewelry pandora sale uk thomas sabo barcklets shop buy cheap online oakley sunglasses charms

  10. oakley uk
    2011/08/19 09:33:25

    thanks for sharing such informative and fantastic post..

  11. Sennheiser Headphone
    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…

  12. juicy couture handbags
    2011/07/16 14:43:57

    I read with great interest.Thanks for you sharing.

  13. juicy couture outlet
    2011/07/16 14:43:35

    Have a fantastic vacation!

  14. designer handbags
    2011/06/01 10:14:43

    Your article write very well.

  15. cheap designer handbags
    2011/05/28 10:18:43

    很好

    • 小杰
      2010/10/03 20:25:17

      你的站也不错啊,呵呵相互交流,共同进步吧

  16. 夜风心理学博客
    2010/09/16 00:16:23

    PHP高手真不少

    • 小杰
      2010/09/16 07:47:43

      我也是只会点皮毛,这个方法不是我的原创,呵呵

  17. 夜风心理学博客
    2010/09/16 00:05:42

    很实用,可以参考

  18. 夜风心理学博客
    2010/09/16 00:04:33

    细节很重要

  19. 服务行业人才网
    2010/09/14 16:23:00

    简单也不简单!就是看自己怎么理解啦!

  20. ugg uk
    2010/09/14 15:20:00

    是的 这个不难的!

  21. sup
    2010/09/13 23:20:10

    哈哈..这个问题是我问的啦….已经改好了….

  22. zhangyang
    2010/09/13 21:02:31

    最简单易懂的方法了,收藏了!

    • 小杰
      2010/09/13 23:09:47

      我也是认为这个方法比较简单了,呵呵

  23. vastar
    2010/09/13 19:44:33

    暂时还没处理到这个细节~

    • 小杰
      2010/09/13 23:06:00

      很值得这样去做的哦

  24. sem说
    2010/09/12 23:48:59

    这种方法很简单,不错。核心在于”target=’_blank’ “

    • 小杰
      2010/09/13 09:24:39

      说的对啊,这就是关键之处

  25. 水缘泡泡
    2010/09/12 23:35:30

    改好了!

  26. 水缘泡泡
    2010/09/12 23:28:58

    谢谢!这个好!

  27. 情感加油站
    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']))) ?>

  28. 红心草
    2010/09/12 20:28:56

    不过我觉得有些人不喜欢这种方式。

    • 小杰
      2010/09/12 22:36:49

      我感觉这个方法是比较简单的啦,呵呵

  29. 乐衣网
    2010/09/12 17:38:13

    嗯,回头试试看

    • 小杰
      2010/09/12 22:38:41

      嗯,这个方法还是不错的哦,试试吧

评论分页: 1 2

发表评论

您的昵称 (必填哦)

您的邮箱 (必填哦)

您的网站

2+8= (麻烦算一下吧(*^__^*) )