Keyword

How to hide the first 5 articles in k2 content module

More
13 years 7 months ago #96075 by hiwa
hi my dear friends , please help me:

Is it possible to have k2 content module start displaying from the 5nd latest article, rather than the first one.?

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

More
6 years 9 months ago #166483 by Gasper
I know it is an old post, but maybe will be searching for an easy solution. I used the following method:

Go to Components->K2->Categories

Choose the leading category if you have one, or the one you wish to apply the effect to and double click on it.

Click on the Display options tab.

There are options for displaying leading items, main items, ... Each of these makes its own <div>, that has its own id and contains the selected number of articles for each. Now just type for example 5 in the Text box next to number of leading items. Then press Save and exit.

Depending on your theme, find an option to add some css to your template (either in Extensions->Templates->Styles ar directly add this line in your css file on your server). The line you have to add is the following:

#itemListLeading {display: none !important;}

What this does is disabling the display of an html tag with the id="itemListLeading", which means that effectively first 5 (note the number we input earlyer) items in choosen category (or all of them, if you made the setup on your leading category) will not be included in the finished html output. So with this method your first 5 items in a category item page can be displayed in a slider (or something else).

Note that this method will work only on category item pages (pages with the list of items for one category) and will not affect yout homepage or other side-, foot- or head-bars.

If you have any further questions regarding this method, simply pm me and I will try to help you (if I find the time).

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #166632 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to hide the first 5 articles in k2 content module
Hello,

This will require some overriding.
github.com/getk2/k2/blob/master/modules/mod_k2_content/tmpl/Default/default.php#L22
The $key variable will give you the position of the item. You can check the key and if it is smaller than 5 you can omit or hide that item.

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

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

More
6 years 9 months ago #166699 by Lisa Mitchell
Replied by Lisa Mitchell on topic How to hide the first 5 articles in k2 content module
One more variant is available.
For those who cannot/doesn't want to go into code changes, an easier and more convenient way is to use Skipped items option.

Skipped Items in K2 content module
You can set x number of items to be skipped in the module display. You can use this option to avoid appearing the same articles in the module blocks. E.g. when you use two module copies with identical settings on the same page.

This parameter was implemented long ago in RAXO All-mode K2 module by client requests.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 9 months ago #166709 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to hide the first 5 articles in k2 content module
Thank you Lisa,

I was not aware of that module.

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