Keyword

Category Blog intro text word limit not working

  • Solomon Hodge
  • Solomon Hodge's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 2 weeks ago #111754 by Solomon Hodge
Hi there,

I've searched this forum high and low, but can't seem to find an exact answer to this, so hopefully someone can assist! As a preface, I have quite a few websites where this is the exact same problem, spanning several years of development, so it's not an isolated issue for me, and clearly I'm missing something.

Here's an example case problem:
- I set up a category on my website titled "Latest News".
- Under "Item view options in category listings" I set introtext to "Show" and Introtext word limit to a random number.
- I create a new Category Blog menu item for the "Latest News" category and save.

In theory, I know that clicking on the menu item should produce a blog with a word limit in effect, followed by a read more button. Instead, I get the entire contents of the content text.

I'm trying to make my sites super easy to use for clients, but this one blog issue has baffled me. I have attempted to try all the tricks shown in this post:
getk2.org/community/New-to-K2-Ask-here-first/13197-IntroText-words-limit-not-working-while-selecting
but no luck.

I do have custom K2 files in my template folder, and am fairly comfortable with editing them. Any advice would be appreciated deeply!

Thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 2 weeks ago #111755 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Category Blog intro text word limit not working
Hello Solomon,

You can use the solution posted by Lefteris
"
Hi. Anyone facing these issues please ensure that:
1. You have correctly setup the settings for the desired category.
2. You have not messed up the settings inheritance.

In any case you can always apply the word limit in your template overrides by calling the following code:

K2HelperUtilities::wordLimit($item->introtetx, 100);"

or in order to make it super easy for your guests you can use two editors, one for introtext and one for full text.
This option is located under the component's advanced settings.

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

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

  • Solomon Hodge
  • Solomon Hodge's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 2 weeks ago #111756 by Solomon Hodge
Replied by Solomon Hodge on topic Re: Category Blog intro text word limit not working
Hi Krikor,

Thanks for your reply. Just wondering which file I would place that in? I tried it in com_k2/templates/default/category_item.php and it made my text disappear!

Thanks :)

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

  • Suba
  • Suba's Avatar
  • Visitor
10 years 6 months ago - 10 years 6 months ago #111757 by Suba
Had the same issue here. Here is how I solved it in case anyone else need to:

Open components/com_k2/templates/default/category_item.php

Find
<?php echo $this->item->introtext; ?>

Replace with
<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 40); ?>

40 is the word limit. The method works fine for me, but I don't really like it, because
1) hacking the core template file will get overwritten by next upgrade.
2) the word limit function in the backend is of no use.

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

  • Solomon Hodge
  • Solomon Hodge's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 6 months ago #111758 by Solomon Hodge
Replied by Solomon Hodge on topic Re: Category Blog intro text word limit not working
Hey Dani,

Thanks for the tip. To help expand upon your idea, try this:

copy: com_k2/templates/default/category_item.php
to: templates/[yourtemplatefolder]/html/com_k2/default/category_item.php

This is the proper way to modify K2 template files.

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

  • Suba
  • Suba's Avatar
  • Visitor
10 years 6 months ago #111759 by Suba
Yep, the template overiding worked for me, and makes my point 1) in my previous post invalid.

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


Powered by Kunena Forum