wpDiscuz show a comment counter?  


Eminent Member
Joined: 1 year ago
Posts: 21
13/11/2017 11:46 pm  

In my old Theme, i've coded a simple comment count to show ongoing numbering right to the comment. My Implementation via functions.php doesn't work anymore, becaus wpdiscuz display the comments in his own way.

Is there a possibility to show a ongoing comment count inside each comment? (e.g. "#1, #2, #3, ...) Here is the Code Example from my Old Comment-Template and the functions.php:

function ping_count( $count ) { 
global $id;
$comments_by_type = &separate_comments(get_comments('post_id=' . $id));
return count($comments_by_type['pings']);
function comment_count( $count ) {
global $id;
$comments_by_type = &separate_comments(get_comments('post_id=' . $id));
return count($comments_by_type['comment']);
add_filter('get_comments_number', 'comment_count', 0);

And the display that in the comment-template, located also in the functions.php:

<div class="comment-number"> 
<a class="permalink" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php $comment_number++; echo $comment_number; ?></a>

I hope, you'll undestand my question 🙂