Keyword

How to use Read More button only when needed?

  • Lizetta
  • Lizetta's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 week ago #104019 by Lizetta
I don't want the read more button to show for every article, only for those where there actually is more to read. In Joomla that is how it works, but I've been working on migrating all of my articles into K2 and noticed that it shows on every item, regardless of whether its applicable or not. I know how to hide it, but then it doesn't show when there actually is more to read.

Am I missing something? I really appreciate the help, and this forum!

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

More
12 years 1 week ago #104020 by Lefteris
Hi. You can apply a check to your layout files to see if an item has more content.
<?php if($this->item->fulltext):?>
	<?php if ($this->item->params->get('catItemReadMore')): ?>
	<!-- Item "read more..." link -->
	<div class="catItemReadMore">
		<a class="k2ReadMore" href="<?php echo $this->item->link; ?>">
			<?php echo JText::_('K2_READ_MORE'); ?>
		</a>
	</div>
	<?php endif; ?>
<?php endif; ?>

Note that the example is taken from the category_item.php. You can modify accordingly the rest layouts.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Lizetta
  • Lizetta's Avatar Topic Author
  • Offline
  • New Member
More
12 years 1 week ago #104021 by Lizetta
Thank you - now where do I find the component_item.php file to add this to? And what other layout files should I add it to?
sorry - very new at this, obviously

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

More
12 years 1 week ago #104022 by Lefteris

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum