WordPress.org

Support

Support » Plugins and Hacks » Hacks » How to display list of parent parent's siblings

How to display list of parent parent's siblings

  • 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!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display list of parent parent's siblings’ is closed to new replies.
Skip to toolbar