SOLVED: Comment count always shows 1

Browser: Edge & Chrome
OS: Windows
URL: Localhost
Ver: 1.12.3

I used the Comments element in the Single Post Template to list all the comments and their count for that post.

There is no issue listing all the comments, but the total comment count always shows as 1, while the post actually has 13 comments. I tested with other posts, and the result remains the same.

I tested using {echo:get_comments_number()} and it correctly returned 13. However, the comment count using Bricks’ comment element always displays as 1.

Even when I added only: in the code element, the count was still incorrect (but it correctly displayed the comment content).

Looking at the Bricks PHP code, I found that calling comments_template() first invokes comments.php in the bricks parent theme :slight_smile:

 <?php
$comments = new Bricks\Element_Post_Comments(
	[
		'settings' => [
			'title'        => true,
			'avatar'       => true,
			'cookies'      => get_option( 'show_comments_cookies_opt_in' ), // Settings > Discussion > Show comments cookies opt-in checkbox
			'label'        => true,
			'formTitle'    => true,
			'formTitleTag' => 'h2',
		],
	]
);
$comments->load();
$comments->init();

But I copied the comments.php into the child-theme from the parent theme and modified the parameters being passed, but it had no effect.

I don’t understand why such a simple count would be incorrect. This issue has been bothering me for two days. Is it a bug or is there a problem with some settings?

1 Like

Hi Kenming,
Thanks so much for your report!

Unfortunately, I cannot reproduce the issue. Please send temporary login credentials, information on where we can see the problem, and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase.

Best regards,
timmse

Sorry, I use the docker to develop the site in the wsl environment, I can’t access via remote logon. :frowning:

Then, I can only ask you to reproduce the problem in an accessible installation.

Could you please check if you have the same issue in your testing environment? If not, it might be a problem with my settings.

Well, I already tried before my first reply:

I too, have this issue, on one of my production sites. Bricks 2.3.10

The post meta shows number of comments correctly, but the comments heading shows only “1 comment” no matter how many comments there are.

I’ll send you a link to see it on a production site in PM; I’ll also try and set up a test environment where you can play with it via admin.

Sent you a link in PM. The issue only appears when I switch the site language to other than English. In English, I get proper amount of comments + the word “comments” properly in plural/singular.

When I switch to Polish, in Meta I get the right amount, but the word “comments” is in singular form; then above the Comments section I get incorrect “1” + “comment” in singular form as well.

Changing back to English I get the correct amount displayed + correct plural/singular (“comments”).

Thanks so much for the additional information! :handshake:

That’s the crucial hint - it seems to happen only with some languages – in your case Polish, and probably Chinese (or similar) , as can be seen in the thread starters screenshot . With German, for example, it’s correct.

We’ll update this task once it’s fixed :v:

1 Like

We’ve addressed this in Bricks 2.3.11, now available as a one-click update in your WordPress Dashboard.

Please read the changelog entry before updating, and let us know if you experience any issues.

1 Like

Ok, we have progress as it now shows the correct amount - but the langauge is wrong.

I get output of “3 comments” in English, despite the rest of the site being in Polish :slight_smile: (after updating to 2.3.11)

Is that a translation issue now, where we just need the translation code to also update, as the number looks correct, but the output is in wrong language (I’ve set mine to Polish but I still get “3 comments” in English)?

Thank you!

It seems the language files weren’t generated correctly, so “comment” or “comments” are still in English.

I just fixed that manually for Polish (it should work in theory—unfortunately, I don’t speak Polish). The language files will be overwritten with the next update—but the fix should already be included by then.

Download the zip, unzip and replace both files in bricks/languages:

Um.. so I did that… and now bricks is in english :sweat_smile: I changed back in admin to english, then again to polish, flushed cache - no go. Bricks still in english. And so are the comments elements, naturally :wink: Maybe it checks some md5sum-like hash of the files that I manually overwrote, and reverts back to english?

That’s strange… I’d suggest we just wait for the actual fix before we keep on experimenting :smiley:
Just re-download the theme from your account, upload it and the language files will be overridden. That should restore the language to its original state.

1 Like