• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Hide empty categories in nav menu?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Hide empty categories in nav menu?

This topic is: resolved

Tagged: categories, nav menu

  • This topic has 7 replies, 2 voices, and was last updated 12 years, 1 month ago by Brad Dalton.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • May 13, 2013 at 5:14 pm #40739
    Tom
    Participant

    I'm trying to improve the *nav/subnav* menu presentation using the Prose child theme by hiding empty category menu items. (Google has been particularly unhelpful in this pursuit.)

    A project uses a large number of hierarchical categories and subcategories that are bulk loaded and prepared in advance as hierarchical menus. This is done in advance due to the amount of work involved and the need to observe strict hierarchy rules.

    Posts are categorized as they are written but this will leave a large number of categories empty for a (potentially long) time and therefore leave a trail of menus that lead to empty category pages.

    The Categories widget, for example, hides empty categories from the categories list/dropdown.  I would like to do the same with the nav & subnav menus - hide the empty category-menu items until the category is populated with a post that includes it.

    Can anyone recommend a method, snippet or plug-in that would alter the navigation menu presentation like this?

    thx.

     


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    May 13, 2013 at 5:58 pm #40751
    Brad Dalton
    Participant

    Can you link to your site please.

    How many categories are you needing to hide?


    Tutorials for StudioPress Themes.

    May 13, 2013 at 7:11 pm #40775
    Tom
    Participant

    Thanks for replying, Brad.   The site is currently on a local dev server.

    Current estimate for categories is ~225 to ~250. Perhaps half of these will be 'empty' until year 2. "It depends."


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    May 13, 2013 at 7:27 pm #40782
    Brad Dalton
    Participant

    I think these should be your tags. You shouldn't use that many categories.


    Tutorials for StudioPress Themes.

    May 13, 2013 at 9:49 pm #40818
    Tom
    Participant

    Thanks for your reco, Brad although I'm not sure of the rationale.

    I'm not aware of a performance issue for a volume of tags versus a volume of categories.  Although it might be possible to encourage some trimming of the overall count, tags do not meet the hierarchical requirement. There would be typically 3 to 4 categories assigned per post, with additional tagging of perhaps 2 to 5 labels.

    Overall, I guess you are saying that there is no way to solve the initial question:
    Can one 'hide' empty categories in nav menus until they are used in posts?


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    May 13, 2013 at 9:59 pm #40821
    Brad Dalton
    Participant

    There is but it might require custom coding as I don't know if there's a plugin for it. I'll let you know if I find a solution.


    Tutorials for StudioPress Themes.

    May 14, 2013 at 11:02 pm #40951
    Tom
    Participant

    Brad, thanks for looking into this. I  think I can say tonight that this has been resolved by using a plugin.

    Code would be cleaner and more certain but this should work out fine using the plugin “Add Descendants As Submenu Items” by Alex Mills (Viper007Bond).  Alex's page is > here <, at or you can obtain it via the plugin page at WordPress.org.

    This escaped my previous searches because it doesn't promise to do what I was seeking ('hide existing categories'), but actually does it a different way in order to achieve a different objective from Alex – automatically add hierarchical items to initialized menus.  Alex created it for posts/pages to be added to menus, I  can use it to add categories to menus as they are first used.

    It took some work to setup and test.  I had to destroy a few large menu trees so that the menu items could be added back  by the plugin.  They aren’t actually added to the menu structure at “Appearance > Menus”, so you have to get the right setup of initial levels of menu structure made by hand so that the plugin can later add to them automatically at lower levels.

    This could be a big time-saver for accurately maintaining large hierarchical category > menu structures.  I know it will be for me as I won’t have to add and place scores and scores and scores of categories as hierarchical menu items, just add a couple dozen at only two levels deep.  With the categories and custom slugs loaded by BulkPress, I’m done!

    Thanks again, Brad

    And thanks to Alex Mills!


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    May 15, 2013 at 10:03 am #41027
    Brad Dalton
    Participant

    No worries Tom. Thanks for the tip on the plugin.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Hide empty categories in nav menu?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble