How to display list of parent + parent's siblings (3 posts)

  1. tdzl
    Posted 5 years ago #

    I'm creating a custom sub-menu for a section of child pages and grandchild pages. The main navigation already displays all top-level pages, so it's not necessary to list them again in this custom menu.

    How would I add the code in my custom template file to display a list of a granchild's parent page and its parent's siblings. For example:

    Page 1
    -Child page 1-1
    -Child page 1-2
    -Grandchild page 1-2-1
    -Grandchild page 1-2-2
    -Grandchild page 1-2-3
    -Child page 1-3
    -Child page 1-4
    Page 2
    Page 3
    Page 4

    When the user is viewing Grandchild page 1-2-1, I would like the sub-menu I'm creating to display Child page 1-1, Child page 1-2, Child page 1-3, & Child page 1-4

    (No need to display the top-level pages, or each grandchild page... just the 2nd level of pages – the grandchild's parents and its siblings.)

    Thanks in advance!

  2. kreegah
    Posted 5 years ago #

    I am also curious and looking for a solution like this using wp_nav_menu (or any other solution)

    Parent 1
    Parent 2
    Parent 3

    and after click say Parent 1

    Parent 1
    - Child 1
    - Child 2
    --Grandchild 1
    Parent 2
    Parent 3

    This would need some jQuery'ing perhaps? Since it's a click-event?

  3. IntlOrange
    Posted 5 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic