Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

Comment counter beside name name does not work for every site

2 Posts
2 Users
0 Reactions
3,324 Views
(@webminfo)
Eminent Member
Joined: 7 years ago
Posts: 21
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#3623]

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: 8 years ago
Posts: 6645
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

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