Keyword

How to add comments counter in the tag view page

  • Matt
  • Matt's Avatar Topic Author
  • Offline
  • Senior Member
More
12 years 9 months ago #61103 by Matt
The tag view page of K2 is somewhat limited compared to the category page. I want to add the same comments counter from the category view page to the tag view page.

I tried to put this code in the tag.php:
<?php if($this->item->params->get('catItemCommentsAnchor') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?>
	<!-- Anchor link to comments below -->
	<div class="catItemCommentsLink">
		<?php if(!empty($this->item->event->K2CommentsCounter)): ?>
			<!-- K2 Plugins: K2CommentsCounter -->
			<?php echo $this->item->event->K2CommentsCounter; ?>
		<?php else: ?>
			<?php if($this->item->numOfComments > 0): ?>
			<a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
				<?php echo $this->item->numOfComments; ?> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
			</a>
			<?php else: ?>
			<a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
				<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
			</a>
			<?php endif; ?>
		<?php endif; ?>
	</div>
	<?php endif; ?>

But that doesn't work and messes up the whole layout. Can someone show me the correct code I have to add in the tag.php file?

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum