Keyword

Show Read More Button Only When Necessary

More
8 years 6 months ago - 8 years 6 months ago #159498 by RS N
Hi, I love K2 but it's very frustrating that the Read More button shows up for every article, whether or not it's needed. I found a code adjustment that fixes this problem in the Category Item view:

Change
<?php if ($this->item->params->get('catItemReadMore')): ?>
to
<?php if ($this->item->params->get('catItemReadMore') && $this->item->fulltext): ?>

and it works perfectly, only displaying the Read More button when there is actually more to read. However, I'm not sure how to adjust the code to achieve the same result for tag view and archive view. Can you please help me?

Also, when displaying items by tag, the posts show up all out of order and not by date, as they do in the category view. How can I fix that?

Thanks!
Last edit: 8 years 6 months ago by RS N.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 6 months ago #159512 by Krikor Boghossian
Replied by Krikor Boghossian on topic Show Read More Button Only When Necessary
It is the same principle instead of catItemReadMore you should look for userItemReadMore and tagItemReadMore.

Also make sure to use $item and $this->item where appropriate.

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

More
8 years 5 months ago - 8 years 5 months ago #159665 by RS N
Thanks but can you please be more specific? Exactly what piece of code should I replace and exactly what code should I use to replace it? Because as I said, I already tried adapting the code in my original post and it didn't work. It seemed to break the site and I just got an error page, so I'm clearly doing something wrong but can't figure out what it is. If you can do as I did in the original post and tell me exactly what code to change, that would be greatly appreciated.

Also, do you have any suggestions for the sort-by-tag view appearing all out of order (I think in tag view, the posts show by date published right now)? Thanks!
Last edit: 8 years 5 months ago by RS N.

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

More
8 years 5 months ago #159732 by RS N
Can anyone help with this?

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

More
8 years 5 months ago #159743 by RS N
Okay, I got the Read More for tag views sorted out but I don't see anything similar for the Date. For instance, there's no date.php so I don't know where to put the adjusted code to force Read More to only appear on the relevant items when viewing by month (using the K2 tools archive module). What php file do I look at to change that?

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

More
8 years 5 months ago #159791 by RS N
Never mind, I figured it out myself.

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

More
8 years 5 months ago #159976 by Michael GaKI
Replied by Michael GaKI on topic Show Read More Button Only When Necessary
Hell RS N,

I have the same problem... In category-view I see overall "read more" at the bottom of the article. But there is nothing more to read.

Which file you modifed to fix it?

The additional Information of Krikor I don´t understand.

Best regards
Michael

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

More
8 years 4 months ago #160040 by jmeander
Replied by jmeander on topic Show Read More Button Only When Necessary
Could you please explain difference between $item and $this->item ? I'm editing for this readmore issue and want to be sure I'm using the right thing.

Thanks!

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


Powered by Kunena Forum