怎样实现wordpress评论倒计数?

2011-12-06 08:02:39 +08:00
 joynic
比如,离50条评论还有23条。50是设置目标,超过50条显示正常评论数。谢谢。
4036 次点击
所在节点    WordPress
4 条回复
Tom_Jerry
2011-12-06 09:30:14 +08:00
给我个联系方式,我帮你搞定。
另外,是厦门的?
joynic
2011-12-06 11:48:52 +08:00
@Tom_Jerry ^_^谢谢。是的,厦门的。可以的话请发邮件给我joynic#gmail.com再次感谢。
joynic
2011-12-06 15:04:26 +08:00
@Tom_Jerry 召唤^_^
joynic
2011-12-06 17:55:04 +08:00
$num_comments = get_comments_number(); // for some reason get_comments_number only returns a numeric value displaying the number of comments
$num_comments_goal = 50;
if ( comments_open() ){
if($num_comments == 0){
$comments = __('No Comments');
}
elseif($num_comments >= $num_comments_goal){
$comments = $num_comments. __('Comments');
}
elseif($num_comments > 1){
$comments = '离'.$num_comments_goal.'条评论还有'.($num_comments_goal -$num_comments). '条';
}
else{
$comments ="1 Comment";
}
$write_comments = '<a href="' . get_comments_link() .'">'. $comments.'</a>';
}
else{$write_comments = __('Comments are off for this post');}

这样行不通。。。求帮助。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/22907

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX