Published on Aug 9, 2019

[Condition] Menu Category Taxonomy Term

Sridhar Katakam

This members-only tutorial for Oxygen provides the steps to register a custom condition using which menus can be shown conditionally on Pages based on "Menu Category" taxonomy selected in the Page edit screens.

Page Edit Screen

This condition is meant to be used for the Template that applies to all static Pages or when editing individual Pages in Oxygen editor.

The selected menu from the list of dynamically generated WP menus will be checked against the menu category set for that Page.

Use Case

Add several Menu components for the various Pages (Ex.: "About Menu" for all about Pages, "Services Menu" for all service pages) and this condition will enable you to load the corresponding menu.

Step 1

Install and activate Custom Post Type UI plugin.

Go to CPT UI > Add/Edit Taxonomies.

Add a new taxonomy like so:

Set Hierarchical to True so it behaves like categories with checkboxes.

Step 2

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Condition] Menu Category for Pages

Code:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $499 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right