How to add K2 related items by category as a module

This is a follow-up to my previous post on adding related k2 items by category. If you have not yet seen that tutorial, you will need to start there as this tutorial assumes you have already created your custom template with the necessary code to display related items by category.

The K2 template system combined with the Modules Anywhere plug-in make a powerful team. Usually, the sidebar is not and cannot be controlled by the component, so we have to rely on modules for specific features. With a little creative thinking (along with the help of these awesome modules), I have learned how to control the sidebar modules through the component. Well, we are not actually controlling the sidebar, but making our own. This allows us to use what is already available to us and avoid any extra time consuming coding.

I am not one for wasting time, so I kept this tutorial short and sweet. Enjoy!

Be Sociable, Share!
Tarik Assagai
Tarik (@tarik916) is a web developer and owner of ACS Digital Media, a Sacramento based web development agency specializing in open source CMS systems. If you are looking for support for your current or upcoming projects, visit


  1. Hi Tarik,
    Do you know how to insert ModuleAnywhere module position tag {modulepos center} inside K2 component template so that we can place any module between the item Title and item body. Actually Inserting this tag in each article body is not possible as articles are submitted by public. and I want to place different module at different categories.
    It is actually creating a new Module Position between the item Title and item body.
    Any help will be highly appreciated.
    BK Manoj Goel

  2. Thanks, great tutorial good info and easy and fast to understand, perfect for people like me :).

  3. James Friesen /

    Good tutorial. I work with custom k2 layouts and Modules Anywhere every week but you clued me in to one thing with Modules Anywhere that I was not aware of… the ability to pass the category_id argument to the module. Of course that’s the key to making this whole thing work and I didn’t even realize you could do that. Cool!

    Mango Tree Media

  4. Useful Tips, anyway, could we short by Category Rating?


  1. How to add related items by category in K2 (Joomla) | Slurp it up! I'm talking about the web. - [...] Part 2: How to add k2 related items in the sidebar as a module. [...]

Leave a Reply