Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.35 KB

Readme.markdown

File metadata and controls

35 lines (23 loc) · 1.35 KB

Dynamic Wordpress Menus

This simple plugin for Wordpress enables you to select a menu for a single page from within the admin interface in Wordpress. It is also possible to get the parent menus in nested page structures.

Notice: This plugin relies on the Meta Box Script for Wordpress by RILWIS which you can download for free here.

Usage

When activating the plugin a meta box will appear whenever editing a page like so:

metabox

You can then access the set menu in your theme like so:

// Get the ID of the set menu
$menu_id = get_menu_for_page($post->ID);

// print the menu if set
if($menu_id > 0)
	wp_nav_menu(array('menu' => $menu_id));

The plugin searches parent pages for set menus if no menu is set by default. This can be disabled by calling the the function like so:

$menu_id = get_menu_for_page($post->ID, false);

Licensing

This plugin is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

CC