开发者

Getting comment count to work on new Wordpress 3.0 theme loop setup

Anyone get this t开发者_如何学编程o work at all? In the new theme, comments are populated using wp_list_comments( array( 'callback' => 'theme_comment' ) );

and I have no idea where this is looping, so I don't know where to start counting a new variable. I can alter the layout of the comments in functions.php, but it's just a function and apparently wordpress is somehow using it only once to populate multiple comments.


If you just want the comment count, why not get_comments_number()?

UPDATE:

function my_comment($comment, $args, $depth)
{
    static $count = 1;

    // do your comment output - $count will increase on each iteration

    // you could copy and paste twentyten's comment callback code here

    $count++;
}

wp_list_comments('callback=my_comment');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜