Simple Section Navigation  for

Simple Section Navigation is a WordPress plug-in that adds a widget for section based navigation. Easy to configure and essential for CMS implementations!

Description

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:

  1. Determine whether the section navigation widget should appear on the home page
  2. Override standard behavior and have the widget show all pages in the current section
  3. Determine whether the widget should appear even if the section only has one page (the top level)
  4. Provide a list of pages to exclude from the output
  5. Determine whether the section navigation should still appear when viewing excluded pages
  6. Determine whether the section title should be linked
  7. 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.

Compatible with WordPress MU. General installation instructions.

Upgrading from pre-2.0

Version 2.0 represents a major change to the plug-in’s internal architecture. Version 2 will attempt to seamlessly upgrade the old the widget, but you should document your current settings before upgrading to be safe. If you are calling it by a function in the template (not using the widget), you will be required to update your template, unless you were using the default settings. The function now has 1 parameter: arguments for the output of the widget, as detailed under installation instructions.

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.

Additional Notes

A full change log is available here.

Possible future features based on demand:

  • Lists private pages if user has permission to see them
  • Light weight mode for sites with only 2 levels of pages

If you’re interested in the origins of this plugin and how it works under the hood, check out this blog post.

As always, feedback and suggestions are welcome!

164 Thoughts Contributed to “Simple Section Navigation”

  1. WP Freak - July 30, 2009 at 11:37 am Reply

    I’m excited to find this plugin but am not quite able to make it do what I want. I’ll try to explain in simple terms. Here’s my site’s navigation.

    Section A
    Sub Page A1
    Sub Page A2
    Section B
    Sub Page B1
    Sub Page B2

    When I’m on either of the section landing pages, I see just what I would expect. I see the title of the section, and a listing of the sub-pages.

    The problem is when I navigate to a child page. What I want to see is the same “section” navigation that I see when I’m on the section “landing page”. But instead, it’s now treating the “Sub Page A1″ as the “parent” and trying to list children pages (which don’t exist).

    I’m hopeful that this is possible because the screenshot at the top of this page shows exactly what I want. in that screenshot, there’s a page called “Clinics” and to the right you can see a sectional navigation called “Get Informed” with Clinics as well as it’s other children all listed.

    Thanks in advance for the advice/response.

    • Oomph
      Oomph - July 30, 2009 at 3:28 pm

      WP Freak – the expected behavior is the behavior you *should* be encountering. Not sure why you’re not getting that. Do you have a link I can look at?

      Can you confirm that you’re using version 2.7 or newer of WordPress, and the current version of the plug-in (1.3)?

    • WP Freak - July 30, 2009 at 10:12 pm

      Thanks for the response.

      I am using the latest wordpress 2.8.2 and the latest version of your plugin.

      Unfortunately, this afternoon I ended up just hard-coding some PHP to accomplish what I wanted into my sidebar, so I don’t have a link for you to look at. If the client isn’t happy with my self-rolled solution I may come back to you and see if you can troubleshoot it, but for now I think I’m good.

  2. Loren - July 31, 2009 at 12:11 pm Reply

    I seem to have run into a conflict between the Simple Section Nav plugin and the Role Scoper plugin. It seems the RS settings override the SSN settings. I didn’t see any comment on this anywhere and wondered if you have run into this at all? I have posted a couple of screen shots showing the problem in my sidebar list:
    http://www.nbseminary.com/wp-content/uploads/image/RS-Conflict01.jpg
    http://www.nbseminary.com/wp-content/uploads/image/RS-Conflict02.jpg
    I have contacted Kevin at RS and am waiting to see what his take is on this issue.

    BTW – thanks for adding current_page_item to the top level. It works nicely.

    • Oomph
      Oomph - July 31, 2009 at 12:19 pm

      Loren,

      Interesting result. I’m not familiar with Role Scoper, and not sure what would could cause the conflict. Simple Section Nav does not use any action hooks or filters, it simply uses straight forward WordPress calls related to getting posts and post ancestors, so (though it’s easy for me to say) the problem is unlikely to be on our end.

      My guess would be that RS is hooking into the get posts (or other post listing) functions and overriding the default behavior that SSN relies on.

      If you can’t get this figured out, we can provide a more in depth analysis (or potentially a different solution that works) through our services, if there’s some budget for that.

      WP Freak – along these lines, I’d bet you have a conflicting plug-in. I’ve double checked, and it’s working as expected on at least 2 WP 2.8.2 sites in a live environment…

    • Loren - July 31, 2009 at 5:00 pm

      Hi,

      Yes, I think it is something to do with RS and I am waiting for a response from the author.

      If I could suggest another feature to add to SSN it would be to give the option for allowing logged-in users to view the list of private pages to which they are entitled (i.e. if they can read them). Currently, even for an admin, private pages are not listed. Branko Ajzele addresses this issue with a different solution over at http://activecodeline.com/create-a-menu-for-private-pages-and-posts-in-wordpress/ .
      This would be a cool addition to SSN as this functionality would again significantly enhance it’s capabilities as a CMS component for WP. Thanks, my friend!

  3. Matt - August 11, 2009 at 2:39 pm Reply

    Hi,

    I installed the plugin and its working great. I am running into a small problem on a few of my pages that display posts. The sub nav disappears. This might fall back on my lack of WP knowledge but I didn’t know if you had any advice to get this corrected?

    Looks good here. Normal page.
    http://arizonaoliveoil.com/about/

    Page with posts it disappears.
    http://arizonaoliveoil.com/news/

    Reappears on subpage of News.
    http://arizonaoliveoil.com/news/calendar/

    Thanks for your time. Matt

  4. Oomph
    Oomph - August 11, 2009 at 9:44 pm Reply

    Mike – turns out you caught a bug that occurs when you try to use the section navigation on a posts page (and archives/posts as a result).

    v1.3.1 was released this evening, and fixes this.

    Loren – we’ll definitely add private page support. To clarify, anyone with subscriber or higher permissions would be able to read private pages, correct? That’s the default WordPress logic, I believe.

    • Loren - August 12, 2009 at 12:06 pm

      I believe that read_private_pages and read_private_posts does not start until the Editor level – unless assigned specifically with a plugin like Role Manager. However default to WordPress the links do not show up when reading the page even for administrators. So current_user_can(’some_role’) functionality needs to be added (I think!). This needs to be an option as plugins like Role Scoper already include this function.

    • Loren - August 12, 2009 at 12:49 pm

      If I understand the WP logic correctly you need to include post_status = ‘publish’ and/or post_status = ‘private’ in your query.

  5. ee - August 17, 2009 at 4:19 pm Reply

    Hi, I need exactly what a previous poster does (see below) — the whole hierarchy showing, as appropriate, not controlled by CSS show/hide. Also, I don’t need it as a widget. I will be hardwiring it and just need a call to the main function. What would it take for you to modify your script?

    I want this view:

    (Current page: Home):
    - Section A
    - Section B
    - Section C
    - Section D

    (Current page: Section B, therefore I can see the subpages):
    - Section A
    - Section B
    – Subsection B1
    – Subsection B2
    - Section C
    - Section D

    (Current page: Section B1, therefore I can see the subsubpages):
    - Section A
    - Section B
    – Subsection B1
    – Subsubsection B1.1
    – Subsubsection B1.2
    – Subsection B2
    - Section C
    - Section D

  6. Stephan - August 21, 2009 at 3:17 am Reply

    Love the plugin :)

    I was wondering if you knew of a simple way to make it so that on a grandchild page, it will only list it’s siblings, or only siblings + it’s own parent.

    Currently it lists siblings as well as all parent level pages.

    A
    A1
    1A
    2A
    A2
    B
    B1
    1B
    2B
    B2

    So If I am at 2B in the above example, I would love to have it so that it displays only B1/1b/2b – right now it shows

    A1
    A2
    B1
    1B
    2B
    B2

    Thanks :)

    • Stephan - August 21, 2009 at 3:20 am

      Doh, formatting didn’t hold in the above. Hope this displays what I mean better.

      Section A
      Sub-Section A1
      Sub-sub-section 1A
      Sub-sub-section 2A
      Sub-Section A2
      Section B
      Sub-Section B1
      Sub-sub-section 1B
      Sub-sub-section 2B
      Sub-Section B2

  7. Loren - September 1, 2009 at 3:15 pm Reply

    Hi,
    The SSN widget does not seem to allow for multiple instances of itself. Is that something that you will be adding? It would be very helpful in some applications.
    Thanks!

  8. ElShaddai Edwards - September 16, 2009 at 8:44 am Reply

    Any chance that an option can be added to disable the a link on the current page? I know I can style current_page_item so that it appears to be non-linked text, but it seems that removing the link would be more efficient.

    Also, any chance that this functionality can be called by a shortcode? I’ve been using the “Section Widget” plugin for page-specific sidebars and would love to be able to add SSN into the mix to better control where it appears.

    • Oomph
      Oomph - September 16, 2009 at 9:00 am

      ElShaddai – we’ll add both of those to the list of future enhancements.

  9. Achim - October 13, 2009 at 5:39 am Reply

    I used your plugin on a wordpress installation of mine and it works great ! Now I installed it on another wordpress blog (same template, both installations 2.8.4) but I get the same behaviour as WPFreak. I have absolute no idea, what causes this problem. On the first site, everything works perfectly (only 1 parent and 4 childs). Even when I visit the child pages, the plugins show the parent and the other children on the same level.

    On the other site nothing is displayed, if I select a child page. Any Ideas ?

    • Oomph
      Oomph - October 13, 2009 at 10:01 am

      Achim – very strange. The way the current version of the plug-in is structured, it’s hard to see how that could happen. The most likely cause is a conflicting plug-in that is hooking the functions I’m using.

      If you turn off all the other plug-ins, does it work? Or are you still seeing the issue?

    • Achim - October 19, 2009 at 11:53 am

      I will give it a try tomorrow !

  10. Bob - October 19, 2009 at 9:53 pm Reply

    Hello, love the plugin. Only thing is I don’t think it’s working right for me. The widget shows up at the parent level (shows children and grandchildren) but not on any of the other pages (children and grandchildren). I’m running WP 2.8.4. I’ve deactivated all plugins but to no avail. Any help would be appreciated.

    • Oomph
      Oomph - October 20, 2009 at 10:18 am

      Bob – I’ll be in touch. Achim – any luck turning off the other plug-ins on your end?

  11. Tim - October 27, 2009 at 1:30 am Reply

    Great work guys. This just saved me a whole lot of wp_list_pages fiddling!

  12. Pingback: Plugins, themes and the IA « Museum In A Day

  13. Jim - November 3, 2009 at 2:58 am Reply

    Accessibility. It’s hugely important in reading. This plug-in is wonderful and appears to be one of a kind. I’m surprised by that; I guess not nearly as many people are using WP as a CMS as I thought. I’m also surprised WP’s inherent coding is so difficult to put serviceable menus and context sensitive table of contents in place. What a great plug-in!

    For those of us who are CSS challenged, I wonder if you could publish the names of the variables to reference your titles and the current page so we can incorporate them into our themes; the before and after fields don’t work in my widget bar, and I’d like to bold the current page on the sidebar.

    Thanks again for the wonderful plug-in.

  14. Ludo - November 9, 2009 at 4:21 am Reply

    Thank you so much for this, this is almost exactly what i wanted !

  15. Achim - November 24, 2009 at 12:23 pm Reply

    Hi,

    no, disabling the plugins didn’t help. Now I have another site, same template, same WP Version (2.8.6) and the same behaviour. If you are interested, i can send you login credentials to a test site who shows this behaviour.

  16. Sharon - December 25, 2009 at 8:13 pm Reply

    Hi,

    Wish I could try out this plug in! But after installing, I don’t see the Section Nav configuration page or a widget on the widgets page. :-( I’m using ver. 2.8.6 and the Atahualpa theme. Any thoughts as to what might be going on? Known incompatibilities? Thanks!

    • Oomph
      Oomph - January 5, 2010 at 8:37 pm

      Hi Sharon – sounds like it didn’t activate correctly? I assume you “activated” the plug-in after installing it… ?

  17. Arthur Baker - January 21, 2010 at 1:35 pm Reply

    Hi,

    Great plugin idea! Hope that I can get it working . . .

    I’m trying to implement this on a test site and it works when I add it to the main page template’s content section, just before the WP loop is called. See here: http://abdesignweb.com/WP-test/about-us/

    But if it is added via the widget in the sidebar, it doesn’t process the php call and no list shows, see here: http://abdesignweb.com/WP-test/candidates-issues/test-page-for-candidates-issues/. If I hard code it before the widgetized area of the sidebar, the same result happens, no list.

    If I put the code in the content area of that last page it will show up the list.

    Any clues as to what I’m doing wrong?

    Thanks,

    Arthur

    • Oomph
      Oomph - January 21, 2010 at 1:40 pm

      I can’t be sure without looking at the code, Arthur. My guess would be that you have a problem in your template – that your new a post query that overrides the default page information somewhere before that widget area.

    • Arthur Baker - January 21, 2010 at 2:59 pm

      >>My guess would be that you have a problem in your template<<

      That was the problem. I'm using Ajaxed WP and to allow the pagination effects on "pages" as opposed to "posts" the following code has to be placed just before calling the loop in the page template:

      [code]
      is_page = false;
      $wp_query-&gt;is_archive = true; ?&gt;

      [/code] (Hope I did that correctly)

      When I used your insertion code just before this php call, it works, if placed after, not at all. Since I was calling the sidebar.php file below the content div closing, which was after that code block, it didn’t work.

      After moving the sidebars call above this code, it now works fine: http://abdesignweb.com/WP-test/candidates-issues/test-page-for-candidates-issues/

      Now, all I have to do if work on the styling.

      Thanks for the quick response!

      Arthur

  18. Pingback: Expectations for Wordpress 3 | Eleventh Edition - A Creative Agency in Glasgow

  19. Michelle - February 8, 2010 at 12:19 pm Reply

    Awesome update, thank you very much! This was a great plugin before and you’ve made it even better.

    I have a request for future versions – adding in the parameters link_before and link_after (as used in wp_list_pages()). I never thought I’d need this, but the latest site I’m working on adds a “»” (>>) symbol in more places than I thought possible. :-)

    Thanks again for the fantastic plugin! It’s incredibly useful.

    Michelle

    • Oomph
      Oomph - February 8, 2010 at 9:07 pm

      Michelle – thanks for the positive feedback! We’ll add those options in a future update. As an interim work around, you can use the CSS “before” property for many browsers.

    • Michelle - March 1, 2010 at 7:00 pm

      Thanks!

      I’ve created a shortcode for this which might be helpful for other people, here it is – hopefully this will work in a comment. :)

      [code]
      // ADD SHORTCODE FOR SIMPLE SECTION NAV
      // To add this to posts, use: [sectionNav]
      // If you would like to enable shortcodes in your sidebar too, uncomment the following line:
      // add_filter('widget_text', 'do_shortcode');
      function my_simple_section_nav() {
      echo simple_section_nav('before_widget=&after_widget=&a_heading=true');
      }
      add_shortcode("sectionNav", "my_simple_section_nav");
      [/code]

    • Michelle - March 1, 2010 at 7:01 pm

      Sorry, I should have said – to get the shortcode function working, paste all of that code into your theme’s function.php file.

  20. Ray Gulick - February 11, 2010 at 9:45 am Reply

    This latest update has created a couple of issues, and I would really appreciate your help:

    1. the plugin inserts an H2 into the list, enclosing the section title.

    Here’s the code I’m using in the sidebar which renders the tags inside the tags: <?php simple_section_nav('before_widget=&after_widget=&a_heading=1′); ?>

    I can deal with an H2 from a CSS perspective, but it’s not semantic; I don’t want an H2 in my subnavigation. I can’t see in your code where or how the H2 is being inserted, though I can find $headclass, which adds a class to it.

    How do I eliminate the H2 in the list?

    2. There used to be a Configuration Panel that showed up under “Settings” in the Admin area of WordPress to adjust settings. Can’t find such a panel with the updated version, although I can see what looks like the code to create such a panel in simple-section-navigation/simple_section_nav.php.

    Here is a link to the WP admin with settings menu pulled down: no Section Nav on menu:
    http://www.evowebdev.com/where-is-SSN.png

    The version of WP I’m running in which I updated SSN is 2.9.1.

    • Oomph
      Oomph - March 22, 2010 at 2:10 pm

      Ray – as you since discovered (re: #2), the settings are now contained in the individual widget, or passed by parameter when using the function.

      2.0.1 adds new “before_title” and “after_title” arguments to the function, so you can override those values (per #1).

What do you think?

(required)

Download Free Now

Current Version: 2.1

Last Updated: June 22, 2010

Oomph is a full-service digital agency providing strategy, design & development and a host of other web services. A leader in WordPress and Drupal implementation, Oomph pushes the boundaries of today’s web platforms. Oomph has a diverse portfolio of non-profits, international corporations and publications. Team Oomph is always thinking creatively about the digital world. Oomph is located in Providence and Boston.