Notifications
Clear all

Comment counter beside name name does not work for every site

2 Posts
2 Users
0 Likes
1,686 Views
(@webminfo)
Eminent Member
Joined: 5 years ago
Posts: 21
Topic starter  

I have a problem when showing the comment counter on my website.

It's working on my site but when I move my site to a new subdomain using Duplicator plugin, it does not show anymore. I have checked the functions.php file and every line of code still there.

The working screenshot:

It does not display comment counter any more:

The code:

/**
* Add comment next username Wpdiscuz
*/
add_filter('wpdiscuz_comment_author', 'my_commentCount', 10, 2);
function my_commentCount($author_name, $comment) {
global $wpdb;
$no_comment = "No comments";
$one_comment = "1 comment";
$more_comments = "% comments";
$count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM ' . $wpdb->comments. ' WHERE comment_author_email = "' . addslashes($comment->comment_author_email) . '"');
$comment_text = my_comment_number_text($no_comment, $one_comment, $more_comments, $count);
return $author_name .' <span class="wpdiscuz-comment-count">'.$comment_text.'</span>';
}
function my_comment_number_text( $zero = false, $one = false, $more = false, $number = 0 ) {
if ( $number > 1 ) { $output = str_replace( '%', number_format_i18n( $number ), $more); } elseif ( $number == 0 ) { $output = $zero; } else { $output = $one; } return $output;
}

Please advice.

Thanks


   
Quote
Topic Tags
Astghik
(@astgh)
Illustrious Member Admin
Joined: 6 years ago
Posts: 5872
 

Hi @webminfo,

We've just checked the theme and it works fine. Please make sure you've checked the code in your active theme's functions.php file. 

Also, delete all caches before checking. If you installed some cache plugins deactivate those plugins and check again. 


   
ReplyQuote
Share:
Scroll to top