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)
- How to avoid wp_nav_menu() ID conflict?
- Remove unusable metaboxes in nav menu management screen
- Highlight parent menu item when child is not in menu
- Building a Sub-menu: Display Parent Category/Page’s Children When Viewing Children
- Output the aria-labelledby parameter for a nav menu child
- Hide menu items for visitors and filter based on role
- Add a “has-children” class to body tag?
- How to remove trailing tags from wp_nav_menu walker
- Custom Walker for Walker_Nav_Menu
- How to scroll item in the Menu setting effectively?
- Building custom API and using wp_get_nav_menu_items to get menu items. Only works when logged in, returns nothing when I’m not
- Appearance -> Menu -> Menu Structure : Add plain HTML code as an element
- Replace menu permalink/hyperlink with only menu name/slug
- wp_nav_menu add some element to container
- get_search_form() doesn’t appear to take parameter into account
- Custom menu deletes itself
- show different admin menu to different user roles
- How to include a third level with wp_get_nav_menu_items function
- Bulk Custom Menu and Wp-Ecommerce
- Check if Page Already Exists in Menu
- Reuse a custom WordPress menu on another WordPress website
- How to dynamically populate a dropdown
- Default WordPress menu content
- Add code to WordPress menu items by class
- how do i change the text under a navigation menu [closed]
- How do you add a around the second level of a Menu?
- Remove admin menu
- Limit User Iinterface for Admin?
- Creating menu and breadcrumb “sections” within WordPress 3 being used as a CMS
- Add custom class to li element which has children
- How to Show Different Menus to Logged in Users in WordPress [duplicate]
- Unable to get menu pattern using a walker
- Menu not adding the right items
- get only the item you click on
- Output Post ID for all nav_items
- wp_nav_menu inside an object — how do I deal with fallback_cb?
- Efficient wp mobile menu
- Echo Menu located in primary navigation
- How to remove top menu item and font awesome icon in WordPress menu?
- 2nd level (drop-down) of the navigation menu not working [closed]
- show a hidden ul if li is active
- How can I make menu items into two seperate buttons with different functions?
- Responsive Dropdown Menu
- How to separate sub-menu output and keep associated with parent
- Different colors for navigation bar
- Eliminate menu collapse button on website
- Best way to build a 500 item menu
- Specifying Class style for Menu
- Convert HTML code to WordPress menu
- How to view menu and submenus in URL
- Permalinks linking to similar named site
- Custom navigation / menu output (walker?)