V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
joynic
V2EX  ›  WordPress

怎样实现wordpress评论倒计数?

  •  
  •   joynic · Dec 6, 2011 · 4913 views
    This topic created in 5257 days ago, the information mentioned may be changed or developed.
    比如,离50条评论还有23条。50是设置目标,超过50条显示正常评论数。谢谢。
    4 replies    1970-01-01 08:00:00 +08:00
    Tom_Jerry
        1
    Tom_Jerry  
       Dec 6, 2011
    给我个联系方式,我帮你搞定。
    另外,是厦门的?
    joynic
        2
    joynic  
    OP
       Dec 6, 2011
    @Tom_Jerry ^_^谢谢。是的,厦门的。可以的话请发邮件给我joynic#gmail.com再次感谢。
    joynic
        3
    joynic  
    OP
       Dec 6, 2011
    @Tom_Jerry 召唤^_^
    joynic
        4
    joynic  
    OP
       Dec 6, 2011
    $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');}

    这样行不通。。。求帮助。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3254 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:44 · PVG 21:44 · LAX 06:44 · JFK 09:44
    ♥ Do have faith in what you're doing.