如何在主题中集成 @reply

Add a comment December 20th, 2008

作品采用署名-非商业性使用-相同方式共享 3.0 许可协议进行许可。转载请注明出自逆时

前几天想在 blog 中加入 @reply 这款插件的时候竟总是启动错误…… 霎时间不知如何是好..
好在, 主题制作砖家 sofish 同学解囊相助, 告知了如何在主题中直接集成一个 @reply ~
在征得 sofish 同意之下, 发此文记录下解决方法.
P.S.: 以下几乎为 sofish 同学原文…. 据悉, sofish 同学也是用此方法在幸福收藏夹所使用的主题中使用 @reply 的.

  1. 上传 reply.js 到主题目录下.
    >>点此下载 reply.js
  2. 在header.php的 </head> 标签前加上下面的代码,调用 reply.js (只在单篇文章调用):
    <?php if( is_single() ) { ?>
        <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/reply.js"></script>
    <?php } ?>
  3. 在functions.php中加入下面的代码:
    function to_leewings() {
        ?>
        <a style="cursor:pointer;font-size:12px;color:#888;" onclick='to_leewings("<?php comment_ID() ?>", "<?php comment_author();?>")' title="Reply to this comment" href="#respond" />[@reply]</a>
        <?php
        }
  4. 在comments.php中需要加入回复按钮的地方加上:
    <?php to_leewings(); ?>
  5. DONE!
  1. December 20th, 2008 at 22:50 | #1

    好,无情沙发掉。OH,haha…

  2. December 20th, 2008 at 22:51 | #2

    @sofish: …..动作真快~~
    转义符的问题.. 不用 chenpress 竟然就解决了……

  3. December 20th, 2008 at 23:22 | #3

    @Leewings: 我那个Blocks2主题太过于强大以至于我都不敢改…

  4. December 21st, 2008 at 10:17 | #4

    之前我也是看Blocks2集成了引用和回复才换了K2

  5. December 21st, 2008 at 14:03 | #5

    可是,看你留言块的 回复 和 @reply 还是 回复显眼诶,要怎么放弃WTC呢..

  6. December 21st, 2008 at 17:10 | #6

    @NetPuter: 我这段时间是不会在我的blog上开启thread comment了…

  7. December 25th, 2008 at 00:54 | #7

    在胡戈戈的WhileWhite主题下测试不成功…点击reply后无效果,只是焦点跳转到了回复框…

  8. December 25th, 2008 at 12:54 | #8

    @sqybi: 回复框里面没有出现 @×× 之类? 如果要+链接.. 要自己去编辑下那个 js 文件的吧.

  9. January 1st, 2009 at 14:27 | #9

    晕,你博客嵌套回复和@name都有啊
    不觉得乱么

  10. January 1st, 2009 at 22:31 | #10

    @Dianso: 随便.. 无所谓的……..~

  11. March 5th, 2009 at 09:05 | #11

    我无语, 多么简单的事情啊..
    无非是引入那个 js 文件, 然后在评论列表的地方插入些代码.. so easy..

  12. March 5th, 2009 at 18:00 | #12

    @锐风: 正如你所说, 它真的很简单. 可这有什么不妥吗?

  13. March 11th, 2009 at 13:25 | #13

    很不错,支持

  14. April 20th, 2009 at 11:22 | #14

    试下去···

  1. No trackbacks yet.
Comments feed