V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
joynic
V2EX  ›  WordPress

怎样实现wordpress评论倒计数?

  •  
  •   joynic · 2011-12-06 08:02:39 +08:00 · 3998 次点击
    这是一个创建于 4496 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比如,离50条评论还有23条。50是设置目标,超过50条显示正常评论数。谢谢。
    4 条回复    1970-01-01 08:00:00 +08:00
    Tom_Jerry
        1
    Tom_Jerry  
       2011-12-06 09:30:14 +08:00
    给我个联系方式,我帮你搞定。
    另外,是厦门的?
    joynic
        2
    joynic  
    OP
       2011-12-06 11:48:52 +08:00
    @Tom_Jerry ^_^谢谢。是的,厦门的。可以的话请发邮件给我joynic#gmail.com再次感谢。
    joynic
        3
    joynic  
    OP
       2011-12-06 15:04:26 +08:00
    @Tom_Jerry 召唤^_^
    joynic
        4
    joynic  
    OP
       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');}

    这样行不通。。。求帮助。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1280 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:50 · PVG 01:50 · LAX 10:50 · JFK 13:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.