• Sign In
    • Forgot your password?
    • Forgot your username?

K2 | The powerful content extension for Joomla! developed by JoomlaWorks

  • home
  • about
  • blog
  • documentation
  • extend K2
  • showcase
  • community
  • demo
Content management as it should have been in Joomla
routing

Enable category ancestors routing

12 July 2012
Published in Tips & Tricks
Recently, I noticed that K2 wouldn't fetch menu item for items in a category that is not a direct parent of it. For example: 
I have My Article which is in the category B, which is a a descendant of the root category A. I created a K2 Categories menu item which uses A as the category. If I viewed My Article by clicking a link from the website I wouldn't retrieve a Menu Item.

The reason it's happening
After digging into the K2's routing system, I noticed it doesn't allow for category ancestors routing. In our case, this means that even though My Article is in a category which is a descendant of A, you still wouldn't get a Menu Item for that, you must have created a specific menu item that uses B.

The fix
In simple words, the fix is to add support for category ancestors routing.
In technical words I have modified two core files of K2 in order to achieve this kind of routing behaviour, therefore if you use this fix you should be careful about it.
I have attached the two files with this message. More
  • Contact us
  • Privacy Policy
  • License
  • K2 Downloads
  • K2 Metrics
  • K2 on GitHub
back to top
Copyright © 2006 - 2025 JoomlaWorks Ltd. All rights reserved. K2 is a joint project by JoomlaWorks & Nuevvo, released under the GNU/GPL license.
Joomla is a registered trademark of Open Source Matters, Inc. K2 is not affiliated with or endorsed by Open Source Matters or the Joomla Project.
designed by Nuevvo