Simple Section Navigation 2.1 for WordPress
A customizable widget for for section based page navigation.
Adds a widget to your sidebar for section (or top level page) based navigation. The title of the widget is the top level page within the current section. Shows all page siblings (except on the top level page), all parents and grandparents (and higher), the siblings of all parents and grandparents (up to top level page), and any immediate children of the current page. Can also be called by a function inside template files.
It includes a simple widget configuration panel. From this panel you can:
- Determine whether the section navigation widget should appear on the home page
- Override standard behavior and have the widget show all pages in the current section
- Determine whether the widget should appear even if the section only has one page (the top level)
- Provide a list of pages to exclude from the output
- Determine whether the section navigation should still appear when viewing excluded pages
- Determine whether the section title should be linked
- Determine page sort order (defaults to menu order)
The widget uses standard WordPress navigation classes, in addition to a unique class around the widget, for easy styling.
Calling section navigation inside template (without widget)
Function name: simple_section_nav()
Parameters:
- show_all – Always show all pages in current section (default: false)
- exclude – Page IDs, seperated by commas, of pages to exclude (default: ”)
- hide_on_excluded – No navigation on excluded pages (default: true)
- show_on_home – Show top level page list on home page (default: false)
- show_empty – Output even if empty section (default: false)
- sort_by – Page sort order; can use any WordPress page list sort value (default: menu_order)
- a_heading – Link heading to the top level page (default: false)
- before_widget – HTML before widget (default: <div>)
- after_widget – HTML after widget (default: </div>)
- before_title – HTML before widget (default: <h2 class=”widgettitle”>)
- after_title – HTML after widget (default: </h2>)
Example:
simple_section_nav('before_widget=<li>&after_widget=</li>&exclude=2&show_on_home=1');
Will wrap the widget in LI tags, exclude page ID 2, and will output on home page.
-
Screenshot of widget output on "Open Source" page under top level page "My Portfolio", running Twenty-Ten theme
-
Screenshot of widget configuration.
What can I do to cause this to not display sibling pages? Other than that, this is a perfect plugin!
You can use CSS to selectively hide siblings… this plug-in is designed to show siblings, so there’s no option for that built in.
Incredible plugin. This does everything I could have asked for with wp_list_pages, and more!
It would be awesome if there was a way to control the depth of children display, so that for instance only the sub-pages of the current page you are on are displayed. Anyway- thanks for a great plugin. =)
Hi there,
Thanks for your plugin ! I was wondering what I could modify in your code to avoid the present page to be linked to itself.
I managed to avoid the title to be linked to itself by modifying the following line :
if ($instance['a_heading']) {
with :
if ($instance['a_heading'] && $post->ID != $top_page) {
But youre are using a filter to render children list … How can I modify it ?
Thansk a lot for your response !
any idea admin ?
Hey there,
your plugin is really awesome, it’s exactly what I was looking for!
I came across a problem though, the navigation won’t show on post pages (the ones that use single.php aka the last ones in hierarchy).
I use the structure Home > Categories as subsites > Post in that Category. My navigation is in the sidebar template.
Navigation shows up on all three levels, even on all pages, except on the site of the post itself. I guess it’s because it doesn’t have any children (?).
I’m also using BreadcrumbNavXT and Pathless Category Links, but deactivating them doesn’t change a thing.
Help would be greatly appreciated
The plug-in is for page navigation, not category navigation.
Hi Jake. This plugin is working great. Thank you!
Is there a way to assign a shorter title for use in the navigation? Similar to how you can do that in WordPress menu manager… so that the page title can be long but then the sidebar link isn’t too long?
This is working fine in terms of the pages displayed, and it appears fine on “static” pages (the them default template). But if I select a different template e.g. a page with posts I get an empty widget container, or in the case of another page with posts option (2 cols, excerpts only) I get the heading but no menu! The theme I’m using is Weaver 2.2.4, example pages are:
working on http://stourvalechurches.org.uk/churches/west-stour/
select “special events” from this – not working
select “testing different templates” – title only appearing
Any advice appreciated
It sounds like the page templates are not resetting the post query (
wp_reset_query() ) after the run special queries to list the posts (etc). The plug-in depends on seeing what the “current” post ID is.hi, i have used your plugin to great effect on many sites and i truly love it. however, on my current project the widget is spitting out all pages in the section on all levels regardless which page you are on. this is a fairly large site, so i’m showing lots of unnecessary cousin pages. i’m wondering if there are any know conflicts between this plugin and others, as I think that may be where the problem lies.
Thanks so much for your help!
Most definitely sounds like a conflict!
WOW!!! I LUV this one too—you read my mind! Together with your Simple Page Ordering, it works great!
I’m a code-clueless WP newbie building a pages-only site, so I’m overjoyed to find a “plug ‘n’ play” portable page-navigation widget that I can use to do what I gotta do.
Right now, it’s in a vertical sidebar. My theme (Suffusion) also enables a “widget area above footer.” I would prefer to have it there with the links side-by-side.
Is this option already built in? After a month-long Crash Course, I can handle a tiny bit of CSS/PHP [huh?] editing; so if you tell me what to do, I can follow your step-by-step instructions.
Hhmmm… I may need the same “Shorter Title” option suggested by Tzaddi to make the link IDs fit where I want them to go.
You are still on my Accounts Payable To-Do List, and I’m about to vote ****** “It Works” with Version 3.2.1 at the WP plug-in page.