In the area above where it says “I need new code here” I simply grabbed the ID using get_post_ancestors like so:
$parent = array();
$parent = get_post_ancestors($post->ID);
$lastNum = end($parent);
wp_list_pages("title_li=&child_of=".$lastNum."");
Related Posts:
- Show just one level of child pages, wp_list_pages woe
- Dynamic menu wp_list_pages displaying only current branch including: current page, his siblings and its childs
- Can you exclude child pages of a specific parent within a navigation?
- Creating navigation out of specific IDs and their children?
- How can I structure my pseudo footer nav code with wordpress codex code?
- Custom Nav walker display current menu item children, or siblings on no children
- Keeping parent menu items active in child pages
- Ways to give a wp_list_pages menu link specific class names?
- wp_list_pages – show pages immediately 1 level below current level
- How do I create a magazine type menu – sub-menu setup using wp_nav_menu and child of twentyten? [closed]
- Handling complex multi-level architecture / menu for large site
- No link on empty page in wp_list_pages
- wp_list_pages sort order is different for different languages [closed]
- How to target children of child pages
- wp_list_pages: only show subpages on the parent page?
- How to have custom menu Item CSS Classes for wp_page_menu() or wp_list_pages()
- Highlight another nav item
- Schedule Page to Menu [duplicate]
- wp_list_pages() but only show children on the branch you are on
- Programmatically add existing pages and subpages to Appearance Menu
- How to retrieve parent menu item name of current submenu item
- Weird behaviour on Edit Menus screen
- Displaying different page links on different pages
- How to remove the HOME menu item
- Listing Child Pages in a Certain Order?
- Active Menu Highlighter with Subpages?
- How to highlight 1st level menu item based on actual page
- Menu Arrow for Child Element
- Orderby menu_order not working; menu is sorted on publish date
- How can I list the current pages siblings and any ancestor page siblings?
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- wp_list_pages Hierarchical Help
- Parent Page > Child Page Menu
- Wp_list_pages not showing children with custom page template
- Check if page has subpages
- horizontal menu / 4-level depth
- wordpress custom menu – show parents, siblings, children depending on depth
- Menu walker: how to tell if a sub menu contains submenus?
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- Showing main menu and child menu in diffent places in a same page
- How to display list of child pages with parent in wordpress?
- wp_list_pages, links only for pages with no children
- “Static” Child Menu with Accordian
- Display all submenus
- Showing Custom Menus in the sidebar
- Second tier sidebar navigation
- Making current_page_item work with wp_list_pages in sidebar on post pages
- highlight parent page on menu when child page is on sidebar (and not on menu)
- Display a portion/ branch of the menu tree using wp_nav_menu()
- Programmatically add a Navigation menu and menu items
- Any docs for wp_nav_menu’s “items_wrap” argument?
- Customizing Only a Specific Menu using the “wp_nav_menu_items” Hook?
- Changing the Order of Admin Menu Sections?
- How make top level menu item not have link, but have sub-menus that are linked?
- Add ‘has_children’ class to parent li when modifying Walker_Nav_Menu
- Get WP Navigation Menu from REST API V2
- How to Hard Code Custom menu items
- How to add a Custom Link to a Menu with a URL that is relative to the blog URL
- How do I remove UL on wp_nav_menu?
- Retrieving a list of menu items in an array
- WordPress default menu in database
- Adding an Arbitrary Link to the Admin Menu?
- Dynamically exclude menu items from wp_nav_menu
- Add “Logout” link to navigation menu
- Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
- Split up wp_nav_menu with custom walker
- Removing container from wp_nav_menu not working
- wp_nav_menu: show menu only if one exists, otherwise show nothing
- Is there an easy way to replace a custom menu link with a page or post?
- Convert output of nav_menu items into a tree-like multidimensional array
- Get page IDs from nav items
- Add a custom walker to a menu created in a widget
- Using a menu walker add a custom item at the end of the menu’s items
- Add settings to menu items in the Customizer
- wp_get_nav_menu_items() not working with slug
- How to get current-menu-item title as variable?
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Add Class to Specific Link in Custom Menu
- Remove a menu item in menu
- A check for if is parent page, if has children, if has grandchildren
- Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
- How do I get the name of a menu in WordPress?
- How to Add to Each Menu Link with link text to data-attr?
- How to manually specify the current active page with wp_nav_menu()
- How to count nav menu items?
- How Does The Walker Class Work?
- Add Javascript to WordPress Menu
- Add custom menu item using wp_nav_menu_items filter
- Filter wp_nav_menu()
- How to modify navigation menu of the “My Account” page in WooCommerce
- remove “edit your profile” from admin menu bar
- WordPress Settings API, Implementing Tabs On Custom Menu Page
- Adding line breaks to nav menu items
- Adding category ID or slug to WP Nav Menu
- add custom class to wp_nav_menu using filter hook nav_menu_css_class
- Custom ID for certain menu item?
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Check if page is in a certain menu
- How can I hide children of draft pages using wp_list_pages()?
- how to create a menu with all sub categories?