Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nested Menus Plugin
#1
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:

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.
Get-Simple Plugins: Nested Menus
Firefox Plugins: Clean and Close, Focus Last Tab
Reply


Messages In This Thread
Nested Menus Plugin - by chrisbloom7 - 2011-11-08, 22:27:46
RE: Nested Menus Plugin - by mrmagoo - 2020-04-21, 23:16:41
RE: Nested Menus Plugin - by Oleg06 - 2020-04-22, 00:01:31
RE: Nested Menus Plugin - by mrmagoo - 2020-04-22, 02:39:43
RE: Nested Menus Plugin - by Oleg06 - 2020-04-22, 04:56:03
RE: Nested Menus Plugin - by mrmagoo - 2020-04-22, 06:24:23
Nested Menus Plugin - by mvlcek - 2011-11-08, 22:52:33
Nested Menus Plugin - by chrisbloom7 - 2011-11-10, 04:00:55
Nested Menus Plugin - by mvlcek - 2011-11-10, 04:07:13
Nested Menus Plugin - by chrisbloom7 - 2011-11-10, 04:42:59
Nested Menus Plugin - by chrisbloom7 - 2011-11-10, 04:43:59
Nested Menus Plugin - by yojoe - 2011-11-13, 07:13:48
Nested Menus Plugin - by chrisbloom7 - 2011-11-16, 04:48:49
Nested Menus Plugin - by jlm - 2011-11-16, 06:28:32
Nested Menus Plugin - by chrisbloom7 - 2011-11-16, 06:46:17
Nested Menus Plugin - by yojoe - 2011-11-16, 12:58:03
Nested Menus Plugin - by chrisbloom7 - 2011-11-23, 11:22:58
Nested Menus Plugin - by yojoe - 2011-11-23, 19:09:41
Nested Menus Plugin - by qlwik1 - 2012-03-27, 21:37:07
Nested Menus Plugin - by richard2233 - 2012-05-02, 01:10:29



Users browsing this thread: 1 Guest(s)