- Posts: 8
COMMUNITY FORUM
Show featured items only in menu page
- kiemthu123
-
Topic Author
- Offline
- New Member
Im using the newest k2 and joomla 3.2 . I have my home page showing all the k2 items. Now I want to create another menu to show only featured items. Im facing with 2 problem then:
1/ If I create a menu to show K2 categories, and then choose only 1 category (parent category), there is no option for me to choose the featured items only.
2/ If I choose many categories (child categories), and enble Only show featured items, the front-end page does show featured items but very messy. There is no introtext limitation so the featured items here display with introimage + full introtext.
Please help me to fix that problem.
Thanks
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- kiemthu123
-
Topic Author
- Offline
- New Member
- Posts: 8
THanks
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- kiemthu123
-
Topic Author
- Offline
- New Member
- Posts: 8
As I told in the begining, I already have my home page showing the top parent (and fetching all items from children categories), so that my home page will show all the items.
And now I want to create another menu page to show only featured items only. However, I cannot choose only one category in the Basic Option, because my Home Page needs to show all the items.
Then, another choice is that choosing multiplie Categores. But choosing multiple categories and applying the option belows the menu to show featured items only, has led me to another issue is that there is no word limitation of the item showing in categories view. When I load that page, it shows all the introtext with the introimage together (full item text and images). I did limit the word limitaion in the K2 parameters but it does not seem to work.
So my question is: how can I have 1 menu showing all k2 items and 1 menu showing featured items only. (did google "k2 limit word in multicategories view" but the guidance is complecated)
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 20); ?>
This will apply a word limit of 20 words.
Please Log in or Create an account to join the conversation.
- kiemthu123
-
Topic Author
- Offline
- New Member
- Posts: 8
Lefteris Kavadas wrote: Unfortunately you will have to make a template override to apply the word limit. Select the new K2 template in the menu link settings and then in the override of category_item.php use:
<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 20); ?>
This will apply a word limit of 20 words.
So where should I put this code in? At the beginning of category_item.php or at the end of it?
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- kiemthu123
-
Topic Author
- Offline
- New Member
- Posts: 8
My code looks like this:
<?php if($this->item->params->get('catItemIntroText')): ?>
<!-- Item introtext -->
<div class="catItemIntroText">
<?php echo K2HelperUtilities::wordLimit($this->item->introtext, 26); ?>
</div>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- kiemthu123
-
Topic Author
- Offline
- New Member
- Posts: 8
I found another solution by modifying the 'latest' view and the itemlist view in this topic getk2.org/community/English-K2-Community/152649-How-Fix---Introtext---Word-limit-for-multiple-categories#152652
Please Log in or Create an account to join the conversation.