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
#2
chrisbloom7 Wrote: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.

This functionality and much more is already implemented in the navigation part of the I18N plugin.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
mvlcek Wrote:This functionality and much more is already implemented in the navigation part of the I18N plugin.

Oh, cool. I didn't need internationalization in my project so I never came across that plugin, and there didn't seem to be any stand-alone plugins that did what I needed.
Get-Simple Plugins: Nested Menus
Firefox Plugins: Clean and Close, Focus Last Tab
Reply
#4
chrisbloom7 Wrote:
mvlcek Wrote:This functionality and much more is already implemented in the navigation part of the I18N plugin.

Oh, cool. I didn't need internationalization in my project so I never came across that plugin, and there didn't seem to be any stand-alone plugins that did what I needed.

It should be possible to just use the navigation part by installing only i18n_navigation of the I18N plugin zip.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#5
mvlcek Wrote:It should be possible to just use the navigation part by installing only i18n_navigation of the I18N plugin zip.

If I need to use internationalization in any future project, I will keep that in mind. For now this plugin does exactly what I need and none of what I don't Smile Hopefully it will be useful to others looking for similar functionality.
Get-Simple Plugins: Nested Menus
Firefox Plugins: Clean and Close, Focus Last Tab
Reply
#6
Version 1.4 has been uploaded. See the plugin page for the change log.
Get-Simple Plugins: Nested Menus
Firefox Plugins: Clean and Close, Focus Last Tab
Reply
#7
Would it be possible to include a function, to show siblings of a specified parent by his URL/name ?
Addons: getsimple theme, Online Visitors, Notepad
Reply
#8
yojoe Wrote:Would it be possible to include a function, to show siblings of a specified parent by his URL/name ?

The Child Menu extension does what you need. It works great for showing a menu of child pages in a sidebar.
Get-Simple Plugins: Nested Menus
Firefox Plugins: Clean and Close, Focus Last Tab
Reply
#9
Hello,

Have you an example that turns your online plugin?
Reply
#10
jlm Wrote:Hello,

Have you an example that turns your online plugin?

See the Install Instructions section on the plugin page.
Get-Simple Plugins: Nested Menus
Firefox Plugins: Clean and Close, Focus Last Tab
Reply
#11
chrisbloom7 Wrote:The Child Menu extension does what you need. It works great for showing a menu of child pages in a sidebar.
Actually it doesn't.
It show only siblings of current page, and I was asking for displaying siblings of defined parent regardless of current page.

Fortunately Mvlcek's navi plugin offers such functionality, but it's not an out of box solution.
Addons: getsimple theme, Online Visitors, Notepad
Reply
#12
yojoe Wrote:
chrisbloom7 Wrote:The Child Menu extension does what you need. It works great for showing a menu of child pages in a sidebar.
Actually it doesn't.
It show only siblings of current page, and I was asking for displaying siblings of defined parent regardless of current page.

Ah, OK, I see what you are after now. I'm not really sure that falls into the scope of what Nested Menus is built for, nor is my plugin really optimized for that behavior. It is closer to what Child Menus aims to do, though currently that plugin is setup to only get the child menu for the current page, not a user-specified page. I would suggest building your own custom plugin to accomplish this, starting by saving the Child Menu plugin file as a different name and then hacking it up to do what you need. I've had to do that for a few plugins of my own when a very custom solution was required.
Get-Simple Plugins: Nested Menus
Firefox Plugins: Clean and Close, Focus Last Tab
Reply
#13
chrisbloom7 Wrote:Ah, OK, I see what you are after now. I'm not really sure that falls into the scope of what Nested Menus is built for, nor is my plugin really optimized for that behavior. It is closer to what Child Menus aims to do, though currently that plugin is setup to only get the child menu for the current page, not a user-specified page. I would suggest building your own custom plugin to accomplish this, starting by saving the Child Menu plugin file as a different name and then hacking it up to do what you need. I've had to do that for a few plugins of my own when a very custom solution was required.

As always It's a matter of time.
GS has a function which returns array with all pages, and it's a base material to create own menu structure.
But the fastest solution to have an aside menu on all pages, was using Mvlcek's navigation plugin.
Navi plugin was improved alot, and despite custom html structure, it covers almost all aspects of displaying navigation menus Wink
Addons: getsimple theme, Online Visitors, Notepad
Reply
#14
Great plugin, thanks! Smile
Reply
#15
chrisbloom7 Wrote:This is the support page for the Nested Menus plugin.

See the plugin page for that latest notes and install instructions....

Is it possible to get this plugin to hide the child menu until the parent is clicked on, then for all the child links to be displayed after?

Nice work by the way!

Richard
Reply




Users browsing this thread: 1 Guest(s)