This is the support page for the Nested Menus plugin.
See the plugin page for that latest notes and install instructions.
This plugin provides a set of template tags to return or print the main navigation as a set of nested pages, i.e. child items under parent. Will return only public items that are set to be displayed in the menu.
Example
Suppose you have a set of pages defined in the admin area like so:
For simplicity sake, let's assume that these are all public pages, set to display in the menu, with their menu prioritization in the same order.
Using the normal menu functions all of those pages would be displayed as a flat unordered list:
Using Nested Menus, we end up with this instead:
Change log
Version 1.4 (Released 9-Nov-2011)
See the plugin page for that latest notes and install instructions.
This plugin provides a set of template tags to return or print the main navigation as a set of nested pages, i.e. child items under parent. Will return only public items that are set to be displayed in the menu.
Example
Suppose you have a set of pages defined in the admin area like so:
Code:
Page 1
Page 2
Sub Page 1
Sub Page 2
Page 3
Page 4
Sub Page 3
For simplicity sake, let's assume that these are all public pages, set to display in the menu, with their menu prioritization in the same order.
Using the normal menu functions all of those pages would be displayed as a flat unordered list:
Code:
<li class="current index"><a href="/" title="Page 1">Page 1</a></li>
<li class="page-2"><a href="/index.php?id=page-2" title="Page 2">Page 2</a></li>
<li class="page-2 sub-page-1"><a href="/index.php?id=sub-page-1" title="Sub Page 1">Sub Page 1</a></li>
<li class="page-2 sub-page-2"><a href="/index.php?id=sub-page-2" title="Sub Page 2">Sub Page 2</a></li>
<li class="page-3"><a href="/index.php?id=page-3" title="Page 3">Page 3</a></li>
<li class="page-4"><a href="/index.php?id=page-4" title="Page 4">Page 4</a></li>
<li class="page-4 sub-page-3"><a href="/index.php?id=sub-page-3" title="Sub Page 3">Sub Page 3</a></li>
Using Nested Menus, we end up with this instead:
Code:
<li class="current index first"><a href="/" title="Page 1">Page 1</a></li>
<li class="page-2 submenu"><a href="/index.php?id=page-2" title="Page 2">Page 2</a>
<ul>
<li class="sub-page-1 first"><a href="/index.php?id=sub-page-1" title="Sub Page 1">Sub Page 1</a></li>
<li class="sub-page-2 last"><a href="/index.php?id=sub-page-2" title="Sub Page 2">Sub Page 2</a></li>
</ul>
</li>
<li class="page-3"><a href="/index.php?id=page-3" title="Page 3">Page 3</a></li>
<li class="page-4 submenu last"><a href="/index.php?id=page-4" title="Page 4">Page 4</a>
<ul>
<li class="page-4 sub-page-3 first last"><a href="/index.php?id=sub-page-3" title="Sub Page 3">Sub Page 3</a></li>
</ul>
</li>
Change log
Version 1.4 (Released 9-Nov-2011)
- Fixed bug that would cause pages not marked for display in the nav to appear anyway
- Added $echo argument to the get_nested_navigation function. It is true by default. Setting it to false will cause the function to return the menu HTML as a string instead of outputting it directly.
- Added an event trigger to clear the cache after a page is deleted.
- Added a check to make sure that a parent page is set to be displayed in the nav before adding any children to it. This should also prevent pages nested deeper than 1 level from mucking up the array.