Comments

A plugin for discussing published content. Features email reply notifications and a reload free posting experience.

Back to Comments Support

brijesh.improve33109
brijesh.improve33109

Hello,

I want to count total comments on specific post how can i get it?

UpTop
UpTop

Hi! You can get the total amount of comments by calling the count field on the comments relation.

brijesh.improve33109
brijesh.improve33109

Sorry But I don't understand and I can't get the specific post total comments so please help me.

UpTop
UpTop

Our sincere apologies for the delay in response.

Let assume you have attached the comments to the Post model and your model variable is called post. In order to get the comment count on that particular model, you can call the count() method on on the comments relation of the model. Like so:

{{ post.comments.count() }}
kevin.vermeulen
kevin.vermeulen

When I use {{ post.comments.count() }} it's not count all comments on a post. For example on this page: https://www.kvntravel.nl/blog/europa/nederland/evenement-deventer-op-stelten-2019
I'm using this code to show in the top an icon including the number of comments. When you click on it (or scroll down), you see more comments visible. Because one of the comment is a reply on a comment.

How can I count all comments together?

1-5 of 5