Forums

The Ultimate Sidebar Navigation (3 posts)

  1. Jonathan
    Member
    Posted 1 year ago #

    Hi,

    I am looking for someone to help me with the ultimate sidebar navigation. Here is the layout:

    Top Level Page 1
    Top Level Page 2
    Top Level Page 3
    Top Level Page 4
    Top Level Page 5

    Each of those pages can have as many as three levels of child pages below it. For example:

    Top Level Page 1
    - 2nd Level Page 1
    - - 3rd Level Page 1
    - - - 4th Level Page 1

    I never want to show all the top level pages because those are already in my main navigation. Instead if I'm on Top Level Page 1 I want to show only one level down. For example when on Top Level Page 1:

    Top Level Page 1
    - 2nd Level Page 1
    - 2nd Level Page 2
    - 2nd Level Page 3

    For every other layer deep I want to show the children and siblings of the current page and all the other ancestors of that page except for the very top level, and I also don't want the siblings if they are part of a different tree. In the example below I don't want to show the 4th level for 3rd Level Page 2. I need it to look like this if on the 4th level.

    Top Level Page 1
    - 2nd Level Page 1
    - 2nd Level Page 2
    - - 3rd Level Page 1
    - - - 4th Level Page 1 (Current)
    - - - 4th Level Page 2
    - - - 4th Level Page 3
    - - 3rd Level Page 2
    - - 3rd Level Page 3
    - 2nd Level Page 3

    Or if I'm on the 3rd level:

    Top Level Page 1
    - 2nd Level Page 1
    - 2nd Level Page 2
    - - 3rd Level Page 1 (Current)
    - - - 4th Level Page 1
    - - - 4th Level Page 2
    - - - 4th Level Page 3
    - - 3rd Level Page 2
    - - 3rd Level Page 3
    - 2nd Level Page 3

    It is pretty easy to get the child pages for every page, but getting only the child pages for that specific tree seems to be pretty tough with wp_list_pages.

    Any suggestions? Please let me know if you need me to clarify anything. Thanks a ton.

  2. Jonathan
    Member
    Posted 1 year ago #

    Just in case anyone comes across this looking for an answer, I ended up using the Simple Section Navigation Widget (http://wordpress.org/extend/plugins/simple-section-navigation/).

    It works exactly how I wanted.

  3. furyjury
    Member
    Posted 4 months ago #

    The plugin also works exactly how I wanted as well.

    Would love some raw PHP code to add instead of a plugin though.

Topic Closed

This topic has been closed to new replies.

About this Topic