• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Hide Empty Categories From Genesis Nav Menu (2 Methods)

This code will work in any theme and is tested using the Genesis Sample child theme by StudioPress. The code removes all categories from any nav menu if they don’t yet contain posts. This way you can setup a new menu under Appearance > Menus, add categories and only the categories containing posts will be displayed in the menu.

Another option is to use code to create a dynamic menu which automatically adds new categories to the menu as they are created but doesn’t display them in the menu unless they contain posts. The code for this is also included in this tutorial at the end of the post.

Here’s the code to exclude empty categories from any nav menu created on the under Appearance > Menus admin screen.

Download Folder

Based on a question from a member:

Looking for function to hide empty categories in Genesis Primary menus.

Here’s the code which enables you to dynamically add new categories when they are created.

Register for full access

Related Tutorials

  • Dynamic Genesis Menu For Categories & Tags

Nav Menu Taxonomy Terms

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags