I would like to have a setting that automatically hides a category in the taxonomy menu when it is empty.

For instance, if there is a site that has three terms, cats, dogs, and weasels and the site has two pages categorized "cats" and one "dogs" but none categorized "weasels", I would like a setting that lets me automatically hide the "weasels" menu if it is empty.

Although individual menus can be disabled, I have a site where item categories are constantly changing and some items are recategorized. Instead of having to manually maintain all of the menus by enabling and disabling them by hand, it would be nice to have this be an automatic process.

CommentFileSizeAuthor
#3 taxonomy_menu-hide_empty_1.patch606 byteshutch

Comments

creatorsdream’s picture

This would be a great feature! I've recently set up a new site and I'm having to manually hide menu items so visitors don't get frustrated realizing there is no content in the menu items.

There isn't any other modules which implement the concept of hiding empty taxonomy terms automatically from listing as menus, is there?

brmassa’s picture

Status: Active » Fixed

Guys,

im a new maintainer and i just launched the new version of the module. it now has this feature.

regards,

massa

hutch’s picture

StatusFileSize
new606 bytes

I found the hide-when term-is-empty function was not working quite right, fortunately it's an easy fix, patch attached.
The variable $num needs to be defined before the 'taxonomy_menu_hide_empty' variable is fetched, so the patch just moves it up 4 lines.

kdebaas’s picture

Category: feature » bug
Status: Fixed » Reviewed & tested by the community

Hi, I noticed that the hide-when-term-is-empty wasn't working quite right (it hid all terms in my secondary links). Then I came across this patch, and applied it. Now, it functions as expected. Thanks.

Anonymous’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.