Skip to content

Hidden Menus

Coding Futures Team edited this page Oct 18, 2013 · 1 revision

One of the things that crops up from time to time is hiding menu items or swapping out menus. Unfortunately while WordPress have a lovely drag and drop menu system there is no easy way to exclude individual items based on content protection without making some modifications to your theme.

You therefore have 3 choices:

  • Use a plugin to swap out menus based on user logged in/logged out
  • Modify your theme code to allow swapping menus depending on status
  • Modify your theme code to allow swapping of menu based on package types

Use a plugin

There are two plugins which can be used to manipulate the menu structure. Both will only work if your theme supports WordPress 3+ wp_nav menus.

Wp Custom Menu Filter plugin

For those who want to present only certain options to logged in users or vice versa there is a simple plugin that relies on a small WordPress hack (it's not written by us) to determine if a menu item is shown to a logged in or logged out user. Wp Custom Menu Plugin

Your Members Filter access plugin

This plugin written by Coding Futures will filter ALL wp-nav based menus through user has access function and will only show the menu items if the user has access. It's important to note this simply checks if the users package account type is selected on the posts right hand side. If you are using no_access or just protecting part of a post/page it will not show in the menu.

Your Members Filter access plugin Note in < YM12 pages that have not been protected by Your Members won't show up in the menu!


Modifying themes to replace menus

The exact steps will be dependent on your theme but on the whole you will need to do 2 things:
  • Register new menus in your functions.php
  • Add code in the header.php
You can then use the normal registration process to show different menus for different users.
Clone this wiki locally