By Niccolo Angeli on Thursday, 02 August 2018
Posted in Technical Issues
Replies 2
Likes 0
Views 815
Votes 0
Hello,
I have customized my article template to show the total number of comments after the title, but the number showed is wrong (it always shows "12 comments") -
see https://accademiainfinita.it/blog/12-coscienza/1016-la-notte-buia-dell-anima, or any other article from the blog https://accademiainfinita.it/blog

Here is the code I am using


<?php
// call Komento comment model
$commentsModel = KT::model('Comments');
$commentCount = $commentsModel->getCount('com_content', $this->item->id);

?>
<!-- Render Komento comments single article page -->
<dd>
<i class="fa fa-fw fa-comments-o"></i> <a href="#comments"><span class="commentCounter" data-kt-counter><?php echo $commentCount; ?> </span><?php echo JText::_('COM_KOMENTO_COMMENTS'); ?></a>
</dd>
<!-- Render Komento comments on single article page - end -->


this code in inserted in
/templates/rt_galatea/html/layouts/joomla/content/info_block.php

which si called in
/templates/rt_galatea/html/com_content/article/default.php

I attach both files for your reference

Thank you
Hi there,

Can you try codes below and see how it goes.

[gist type="php"]
<?php
// call Komento comment model
$commentsModel = KT::model('Comments');
$commentCount = $commentsModel->getTotal('com_content', $this->item->id);
?>
<!-- Render Komento comments single article page -->
<dd>
<i class="fa fa-fw fa-comments-o"></i> <a href="#comments"><span class="commentCounter" data-kt-counter><?php echo $commentCount; ?> </span><?php echo JText::_('COM_KOMENTO_COMMENTS'); ?></a>
</dd>
[/gist]
·
Friday, 03 August 2018 11:30
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post