以下为原创笨教程,需要转载只要注明就OK了,囧rz…
相信用WP做BLOG的人都用过wordpress-thread-comment这个插件吧?很强大的一个插件,但是美中不足的是在发表评论时,他没有做到更新评论总条数或者统计评论中属于回复的评论的总数的功能。
要实现这项功能有什么办法呢?(我不知道有没别的插件更好,囧RZ有的话告诉我一下)其实不难,只要你会WP建立页面时的那个调用模板就OK了!要改动的文件只有3个,一个是wordpress-thread-comment插件目录下的wp-thread-comment.js.php,wp-thread-comment.php和自己主题风格中的comments.php文件,注意:这里用了模板的话就不是他了,页面自定义调用模板的方法,不懂可以留言,我虽然也是WP新手但是很乐意给你回答。好言归正卷,首先我们改的是comments.php文件,通常没修改过的情况下在开头的前几行会发现一下代码:
1 2 3 4 5 6 | <h2 id="comments"> <?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?> <?php if ( comments_open() ) : ?> <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">»</a> <?php endif; ?> </h2> |
我们把他改为
1 2 3 4 5 6 7 8 9 10 11 12 | <h2 id="comments"> <?php if ( $comments ){ echo '<span id="mnum">'.count($comments).'</span>留言主题'; global $id; echo '(含<span id="rnum">'.(get_comments_number($id)-count($comments)).'</span>回复)'; } else echo '没有留言主题' ?> <?php if ( comments_open() ) : ?> <a href="#postcomment" title="<?php _e("发表留言"); ?>">»</a> <?php endif; ?> </h2> |
当然这里要是你要求是评论页的而不是留言页的,你就适当修改为需要的。

枫林驿,链接已加。加油哦~
回复
回复
很好
回复
绝了绝了,我今天从下午一直到现在,都在琢磨这个插件,被逼得没办法,去WP论坛上一搜就找到你这儿来了,早知道直接来你这里看了,呵呵
回复
回复
你意思是:你想更改主题下的css来更改他的样式?
回复
可以的!
回复
不过不是修改wp-thread-comment.php而是修改wp-thread-comment.js.php的310行左右wptctextreplace($s(‘newcomment’),rs)
这里的rs你那里可能不一样
这行下面增加一下代码:
var tmp=document.createElement(“div”);
tmp.innerHTML=rs;//这里rs要跟上面那个一样 $(tmp.firstChild.id).style.cssText=”background:red”;
回复
我遇到了更麻烦的问题 。。。


给我看看啊,,,
我的“回复”简直就是摆设 。。。。
帮忙咯 。。。
谢谢
回复
你回复插件的问题,文件不在我不能调试,很难知道哪里出了问题,估计是文件不完整或者插件冲突造成的。尝试下载一个别的下载地址的试下。要是还不行就在wp-thread-comment.js.php这个文件的310行左右找到
var tmp=document.createElement(“div”);
这一句在它上面加以下语句,
alert(req.responseText);
保存,然后尝试回复,看提示什么,把内容发我看
回复
试一试啦~~~~
回复
Nor do we know what social policies and norms will best facilitate fair terms of cooperation in the interactions of men and women over issues of work, career, and childrearing. ,
回复
In general I find public schools to cater to the lowest common denominator. ,
回复
回复
博主好强,如何做到移动的评论框,和回复框的效果!
回复