Overview
WP-Menu is a WordPress plugin that gives you a customizable hook to pull Page Navigation into a theme. Page Exclusion, Inclusion, Site Map, Top Level, Secondary menus and more.
Installation
To install, follow these simple steps:
- Log into your WordPress site
- Navigate to wp-admin/plugin-install.php on your site (WP Admin » Plugins » Add New)
- Type "WP-Menu" into the Search box and click "Search"
- Find this plugin in the list and click "Install" on the right-hand side of the listing
- Click "Install Now" in the popup
- Click "Activate Plugin" after the installation has completed
Or you can try Manual Installation:
- Download this plugin zip file from WordPress Extend
- Unpack the entire contents of this plugin zip file into your wp-content/plugins/ folder locally
- Upload to your site
- Navigate to wp-admin/plugins.php on your site (WP Admin » Plugins » Installed)
- Find this plugin in the list and click "Activate" directly below the description
Usage
<?php
wp_menu('nav_type=sitemap&nav_levels=2');
?>
Options
- Format Related
- nav_tag
- nav_wrap
- div
- heading
- active
- Style Related
- nav_class
- nav_id
- div_class
- nav_id
- active_class
- unique_class
- unique_prefix
- Settings
- return
- nav_type
- nav_levels
- this_id
- parent_id
- parent_href
- target
- accesskeys
- exclude
- include
- exclude_uri
- show_home
- home_path
- home_link
- start_link
- start_title
- nofollow
- c2p_cid
- c2p_pid
- b2p_pid
- Format Related
-
nav_tag
- Description
The formatting tag to use for the menu. If you choose UL or OL, it will use LI for the items. If you choose DL, it will use DD for the items.
- Accepted Values
-
- ul
- ol
- dl
- Default Value
- ul
- Example Input
<?php wp_menu('nav_tag=ol'); ?>- Example Output
<ol> .... menu here .... </ol>
-
nav_wrap
- Description
Whether or not to wrap the first level of navigation in the nav_tag.
- Accepted Values
-
- 0 = off
- 1 = on
- Default Value
- 0
- Example Input
<?php wp_menu('nav_type=single&nav_wrap=0'); wp_menu('nav_type=single'); ?>- Example Output
.... menu items here .... <ul> .... menu items here .... </ul>
-
div
- Description
Wrap menu in a DIV in addition to the nav_tag.
- Accepted Values
-
- 0 = off
- 1 = on
- Default Value
- 0
- Example Input
<?php wp_menu('nav_type=single&div=1'); ?>- Example Output
<div> <ul> .... menu items here .... </ul> </div>
-
heading
- Description
Include a heading (current page title) above the menu. If DT is chosen, DL must be set as nav_tag. If div is set to on, this will appear within the DIV wrapper tag.
- Accepted Values
-
- 0 = off
- h2
- dt
- Default Value
- 0
- Example Input
<?php wp_menu('nav_type=single&heading=h2'); wp_menu('nav_type=single&nav_tag=dl&heading=dt'); ?>- Example Output
<h2>Current Page Title</h2> <ul> .... menu items here .... </ul> <dl> <dt>Current Page Title</dt> .... menu items here .... </dl>
-
active
- Accepted Values
-
- item
- link
- Default Value
- item
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&active=link'); ?>- Example Output
<ul> .... other menu items here .... <li class="selected"><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul> <ul> .... other menu items here .... <li><a href=".... permalink ...." class="selected">.... page name ....</a></li> .... other menu items here .... </ul>
- Style Related
-
nav_class
- Description
Assign a class to the nav_tag.
- Required
- nav_wrap=1
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=single&nav_class=menu'); ?>- Example Output
<ul class="menu"> .... menu items here .... </ul>
-
nav_id
- Description
Assign a class to the nav_tag.
- Required
- nav_wrap=1
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=single&nav_id=menu'); ?>- Example Output
<ul id="menu"> .... menu items here .... </ul>
-
div_class
- Required
- div=1
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=single&div=1&div_class=menu'); ?>- Example Output
<div class="menu"> <ul> .... menu items here .... </ul> </div>
-
nav_id
- Required
- div=1
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=single&div=1&div_id=menu'); ?>- Example Output
<div id="menu"> <ul> .... menu items here .... </ul> </div>
-
active_class
- Accepted Values
-
- (string)
- Default Value
- selected
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&active_class=current'); ?>- Example Output
<ul> .... other menu items here .... <li class="selected"><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul> <ul> .... other menu items here .... <li class="current"><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul>
-
unique_class
- Description
Add the current item's Page ID to the class of the item (LI / DD). Interfaces with unique_prefix.
- Accepted Values
-
- 0 = off
- 1 = on
- Default Value
- 0
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&unique_class=1'); ?>- Example Output
<ul> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul> <ul> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul>
-
unique_prefix
- Description
Change the prefix that appears before the Page ID of the current item (LI / DD). Requires unique_class to be set to on.
- Required
- unique_class=1
- Accepted Values
-
- (string)
- Default Value
- wpmenu
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&unique_class=1'); wp_menu('nav_type=single&unique_class=1&unique_prefix=mymenu'); ?>- Example Output
<ul> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul> <ul> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="wpmenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul> <ul> <li class="mymenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="mymenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="mymenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> <li class="mymenu-.... page ID ...."><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul>
- Settings
-
return
- Accepted Values
-
- 0 = print
- 1 = return
- Default Value
- 0
- Example Input
<?php $menu = wp_menu('return=1&nav_type=sitemap'); ?>
-
nav_type
- Accepted Values
-
- single
- secondary
- sitemap
- single_secondary
- Default Value
- single
- Example Input
<?php wp_menu('nav_type=secondary'); ?>
-
nav_levels
- Accepted Values
-
- 0 = all
- 1 or higher = stop menu after this level
- Default Value
- 0
- Example Input
<?php wp_menu('nav_type=sitemap&nav_levels=2'); ?>
-
this_id
- Description
Change the Page ID referenced for active_class to be applied to if active.
- Accepted Values
-
- (int)
- Default Value
- $post->ID
- Example Input
<?php wp_menu('nav_type=single&this_id=5'); ?>
-
parent_id
- Description
Base the menus off of this ID, if given.
- Accepted Values
-
- (int)
- Default Value
- 0
- Example Input
<?php wp_menu('nav_type=single&parent_id=5'); ?>
-
parent_href
- Description
Base the menus off of this URI, if given.
- Accepted Values
-
- (string)
- Default Value
- URI for parent_id
- Example Input
<?php wp_menu('nav_type=single&parent_href=/about-us/'); ?>
-
target
- Description
Set the target for the menu links.
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&target=_blank'); ?>- Example Output
<ul> .... other items here .... <li><a href=".... permalink ....">.... page name ....</a></li> .... other items here .... </ul> <ul> .... other items here .... <li><a href=".... permalink ...." target="_blank">.... page name ....</a></li> .... other items here .... </ul>
-
accesskeys
- Description
See this article for more information about the accesskey attribute and how it relates to your navigation.
- Accepted Values
-
- 0 = off
- 1 = on
- Default Value
- 1
- Example Input
<?php wp_menu('nav_type=single&accesskeys=0'); wp_menu('nav_type=single'); ?>- Example Output
<ul> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> </ul> <ul> <li><a href=".... permalink ...." accesskey="1">.... page name ....</a></li> <li><a href=".... permalink ...." accesskey="2">.... page name ....</a></li> <li><a href=".... permalink ...." accesskey="3">.... page name ....</a></li> <li><a href=".... permalink ...." accesskey="4">.... page name ....</a></li> </ul>
-
exclude
- Description
Exclude these IDs from the menu. Must be provided as comma-separated values.
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=single&exclude=4,10,49'); ?>
-
include
- Description
Include ONLY these IDs from the menu. Must be provided as comma-separated values.
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=single&include=4,10,49'); ?>
-
exclude_uri
- Description
Do not show pages that have this URI in their permalink.
- Accepted Values
-
- (string)
- Default Value
- none
- Example Input
<?php wp_menu('nav_type=sitemap&exclude_uri=thank-you'); ?>
-
show_home
- Description
To show or not to show the Home link, must provide home_path.
- Required
- home_path
- Accepted Values
-
- 0 = off
- 1 = on
- Default Value
- 1
- Example Input
<?php wp_menu('nav_type=single&show_home=0&home_path=/home/'); ?>
-
home_path
- Description
Your home page's URI (if you've created a page called "Home" in WP to be served as your home page). Meant to be used in conjunction with home_link, or to exclude the Home link from the menu using show_home.
- Accepted Values
-
- (string)
- Default Value
- /home/
- Example Input
<?php wp_menu('nav_type=single&home_path=/my-home/&home_link=/'); ?>
-
home_link
- Description
Used to link home_path to a new URI if necessary.
- Required
- home_path
- Accepted Values
-
- (string)
- Default Value
- /
- Example Input
<?php wp_menu('nav_type=single&home_path=/my-home/'); wp_menu('nav_type=single&home_path=/my-home/&home_link=/about/'); ?>
-
start_link
- Description
Adds a new menu item to the beginning of the menu. Interfaces with start_title.
- Accepted Values
-
- false = off
- (string) = URI
- Default Value
- false
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&start_link=/'); wp_menu('nav_type=single&start_link=/&start_title=Blog'); ?>- Example Output
<ul> .... menu items here .... </ul> <ul> <li><a href="/">Home</a></li> .... other menu items here .... </ul> <ul> <li><a href="/">Blog</a></li> .... other menu items here .... </ul>
-
start_title
- Description
Changes the name of the new menu item at the beginning of the menu. Requires start_link.
- Required
- start_link
- Accepted Values
-
- (string)
- Default Value
- Home
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&start_link=/'); wp_menu('nav_type=single&start_link=/&start_title=Blog'); ?>- Example Output
<ul> .... menu items here .... </ul> <ul> <li><a href="/">Home</a></li> .... other menu items here .... </ul> <ul> <li><a href="/">Blog</a></li> .... other menu items here .... </ul>
-
nofollow
- Description
Adds nofollow to links. To target specific Page IDs, comma-separated values are required.
- Accepted Values
-
- false = off
- all = on for all links
- (string) = specific Page IDs
- Default Value
- false
- Example Input
<?php wp_menu('nav_type=single'); wp_menu('nav_type=single&nofollow=all'); wp_menu('nav_type=single&nofollow=1,3,4'); ?>- Example Output
<ul> <li><a href=".... permalink ....">.... page name ....</a></li> .... other menu items here .... </ul> <ul> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> </ul> <ul> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ...." rel="nofollow">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> <li><a href=".... permalink ....">.... page name ....</a></li> </ul>
-
c2p_cid
- Description
To "link" a Post Category with a specific Page on your navigation so it appears as "selected". Category ID for Category, requires c2p_pid.
- Required
- c2p_pid
- Accepted Values
-
- (int)
- Default Value
- none
-
c2p_pid
- Description
To "link" a Page with a specific Post Category on your navigation so it appears as "selected". Page ID for Category, requires c2p_cid.
- Required
- c2p_cid
- Accepted Values
-
- (int)
- Default Value
- none
-
b2p_pid
- Description
To "link" your Blog (all posts) with a specific Page on your navigation so it appears as "selected". Page ID for Blog.
- Accepted Values
-
- (int)
- Default Value
- none
400 E Royal Ln