So it turns out to be a bit easier than I thought:
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
}
?>
<?php $args = array(
'depth' => 0,
'date_format' => get_option('date_format'),
'child_of' => $parent,
'title_li' => __(''),
'sort_column' => 'menu_order, post_title'
); ?>
<ul>
<?php wp_list_pages( $args ); ?>
</ul>
Related Posts:
- How to have custom menu Item CSS Classes for wp_page_menu() or wp_list_pages()
- I need ideas for a complicated menu
- Menu with parents, children and or siblings pages display
- wp_list_pages to show all pages on all sub pages
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- Exlude pages from wp_list_pages
- How can I add a delay to the collapsible menu in Twenty Eleven?
- Top Nav submenus wpon’t stay open – only in FF and only sometimes [closed]
- Add ID to target navigation link
- Creating navigation out of specific IDs and their children?
- Problem with sub-menu container
- Custom navigation bar via wp_list_pages is broken for blog roll
- wp_nav_menu: check if the list item has children and add a class to anchor link
- Add custom meta to nav menu items
- Display navigation menu item conditionally based on user capabilities
- Show just one level of child pages, wp_list_pages woe
- Remember the last post I read
- Export navigation menu
- Prev/Next child navigation for current page?
- Multi Level Bootstrap Navigation Menu in WordPress
- List child pages of a specific page
- How to modify the “after” of last element in wp_nav_menu
- Show only 2nd level of navigation depending on active navigation
- How do I retrieve menu items from one level only?
- Edit HTML of WordPress navigation bar
- Using FlexNav with WordPress [closed]
- Test if page is child and has children, if so echo child pages also on grandchild pages
- How to make Next and Previous attached image navigation on the attachment page? [duplicate]
- Customizing Walker_Nav_Menu
- Get only the path from a function like previous_post_link
- Break apart wp_list_pages in order to customise it
- Custom Nav Walker sub-menu HTML construct
- Text symbols in the navigation menu
- Generate a tabbed submenu — from taxonomy term or submenu item — with sample content
- Adding different classes to anchor in navigation menu
- how to automatically generate hierarchical menus from hierarchy of pages?
- Can this navigation be done easily in WordPress?
- Making some links generated from the wp_nav-menu function unclickeable?
- Trouble with wp_nav_menu, conditional tags and fallback_cb
- Handling complex multi-level architecture / menu for large site
- Previous & Next on Index Page broken
- Using dividers in menu navigation – where to add code?
- How to display dynamic content in start_lvl function
- Two Navigation Menus – secondary nav is including main nav
- Twenty Eleven theme- have custom landing page, change nav “home” link
- Exclude Post Format from next_post and prev_post
- Hierarchical Custom Posts – Highlighting Current Post in Sub-Menu
- Using query_posts inside single.php loop
- wp_list_pages: only show subpages on the parent page?
- Menus like a CMS
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- Check if menu id = $specific_id – then insert specific
- posts_nav_link on single.php
- How to get back to same page of post-list – after updating a post
- how to change site tag line for particular pages
- dropdown navigation menu
- Bootstrap Navwalker not displaying
- Highlight another nav item
- Listing child pages depending on user capability (role)
- wp_nav_menu() with multiple Class
- How to add show/hide in navigation setting for pages
- Home Custom Menu Link not Working
- How Do I Add Next and Previous Links On Single Custom Post Type Only?
- Inserting specific images inside navigation menu
- wordpress wp_list_pages help
- Navigational drop-down lists in WordPress?
- Select first child/subpage item in wp list pages
- Fallback_cb is messing around with containers
- Only show top-level links in site navigation
- Current navigation highlight for a menu that may be modified by the user?
- Trying to Create Menu in WordPress
- How do I add recent posts to the menu?
- Automatically list top level menu item child pages
- WordPress – Responsive navbar doesnt work
- Check if menu_item has children or has parent
- Adding dropdown box to WordPress menu
- Help with Sub and Sub-Sub Navigation
- How to target grandchild of post_parent using wp_list_pages
- get_adjacent_post – in same term or category not working
- Exclude post format from navigation
- How to make previous_post_link into an image [duplicate]
- How to add swipe action to wordpress pages
- Walker_Nav_menu access parent menu name
- Can I use multiple nav_walkers?
- (Bluehost) navigating to the dashboard via mydomain.com/wp-admin/ results in directory listing
- Implementing the twentythirteen responsive menu in twentytwelve
- Using characters to separate menus in navigation bar
- How to hide ‘Home’ button from appearing on supages – twenty eleven theme
- reverse next/prev page order
- Add a submenu to wp_nav_menu
- How to add rel=”nofollow” to wp_list_pages?
- How to list pages with thumbnails, adding a “current-item” class
- Check if current post is the latest (not last)
- How does the Twenty Twelve Navigation Bar work?
- navigation link based on custom field
- Switch form Next/Previous to post title
- add a menu item to navigation menu to link to external url
- Give Children Unique ID’s
- Using categories on navigation bar instead of pages
- confused about wp_list_pages() function – how to display selected top pages with all their subpages