Keyword

[SOLVED] Hide Empty categoris

  • Mohsen Babaei
  • Mohsen Babaei's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 9 months ago #122704 by Mohsen Babaei
[SOLVED] Hide Empty categoris was created by Mohsen Babaei
Hello
I want to hide categories that are empty, I mean that I want the subcategories to be shown in category list and k2-tools module just when an item publish in it.
Can any one help me?
thanks

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 9 months ago #122705 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Hide Empty categoris
Unfortunately K2 does not have this setting.

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

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

  • olsen
  • olsen's Avatar
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
10 years 9 months ago #122706 by olsen
Replied by olsen on topic Re: Hide Empty categoris
Well, actually it can be done with a template override. Modifying file category.php with an if statement in the subcategory loop to check if the subcategory has items on it.

Something like:
<?php if ($subcategory->numofitems > 0) :?>
LOOP

<?php endif ;?>

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

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

  • Mohsen Babaei
  • Mohsen Babaei's Avatar Topic Author
  • Offline
  • Junior Member
More
10 years 8 months ago #122707 by Mohsen Babaei
Replied by Mohsen Babaei on topic Re: Hide Empty categoris

olsen wrote: Well, actually it can be done with a template override. Modifying file category.php with an if statement in the subcategory loop to check if the subcategory has items on it.

Something like:

<?php if ($subcategory->numofitems > 0) :?>
LOOP

<?php endif ;?>

Hello and thanks, I copied your code in category.php for Subcategories, then both empty and non-empty categories disappeared. could you tell me where in category.php should be change?
Thanks

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


Powered by Kunena Forum