You can use get_page_children
function to retrieve all sub pages
$the_query = new WP_Query( array( 'post_type' => 'page', 'posts_per_page' => -1 ) );
$children = get_page_children( get_the_ID(), $the_query->query() );
if ( !empty( $children ) ) {
foreach ( $children as $child ) {
// render menu
}
}
Related Posts:
- Subpages List Appearing on Every Page
- WordPress two row automatic sub navigation with double wp_list_pages. Is it impossible?
- Custom menu walker: how can i check first item
- How to add a child item to a menu element (using wp_nav_menu_objects)
- Primary and secondary menus
- how to get custom admin submenu( custom post type ) item to highlight when its active
- Handling complex multi-level architecture / menu for large site
- 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()
- Walker nav remove submenu ul from a certain depth
- WordPress bootstrap menue with 3. level
- Subnav menu – adapt to show the same on parent, child & grandchildren pages?
- disable menu collapse/expand function and make a menu item a static, unclickable text
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- Submenu causes issue in defined blog page
- Define supporting only 1-level menu
- How to target grandchild of post_parent using wp_list_pages
- Get the page IDs of a Particular Menu item’s submenu
- sub-menu does not show on the very top bar
- How to hide Newsletter plugin submenus from the Dashboard?
- How to exclude/remove submenu using Walker_Nav_Menu
- Listing Sub-Pages & Sub-Sub-Pages
- wp_list_pages() not showing on posts
- Links doesnt appear as a submenu on a mobile
- Notices are render inside sub-menu’s content
- Problem add submenu page
- Creating navigation out of specific IDs and their children?
- Controlling the position of dropdow submenu
- Assign index page to my mobile site?
- Restrict days in bootstrap datepicker using checkboxes in submenu
- Need help finding information to create this type of page
- Trouble posting in Sub-Category
- How to display list of child pages with parent in wordpress?
- Active class on side menu
- Display all submenus
- I need to get this sub nav to show up on cat, sup-cat and post
- Horizontal sub-menu on one line
- Display a portion/ branch of the menu tree using wp_nav_menu()
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Remove Categories / Tags From Admin Menu
- WordPress API Menu/Submenu Order
- Add an admin page, but don’t show it on the admin menu
- Getting custom admin submenu item to highlight when its active
- Add custom menu item using wp_nav_menu_items filter
- How can I hide children of draft pages using wp_list_pages()?
- how to create a menu with all sub categories?
- Return parent post with its children using WP_Query?
- Remove a menu item created by a plugin
- Add separator to admin submenu
- Display only page specific sub menu items using Custom Walker
- Add custom html to last sub-menu item
- Show just one level of child pages, wp_list_pages woe
- Add a .last class to the last in each ul.sub-menu
- Shortcode producing headers already sent error
- Order Admin sub-menu items?
- How Can I remove or hide the export page in WordPress menu?
- Get page by template?
- Multi Level Bootstrap Navigation Menu in WordPress
- Add class to top level menu item if it has multiple child levels
- How show sub menu only using wp_nav_menu()
- How to give position to Submenu under custom post type
- Highlighting current item of custom post types’ sub pages, listed by wp_list_pages
- Show only 2nd level of navigation depending on active navigation
- How to hook wp_list_pages?
- Reorder custom submenu item
- Simple Navigation Walker – Wrapper-class around first sub-menu
- How Do I Programmatically Better Organize Custom Post Type Menus?
- How to get a separate child menu?
- Exclude one item from wp_list_pages( $args );
- Is there a way to keep a custom menu expanded when editing a custom post type?
- wp_nav_menu() loses ‘current-menu-*’ classes on single product page within category
- Is there a way to make a custom Page type?
- How does wordpress calculate the page depth?
- How to List All Pages (With their template names) Within a Website
- How to drag multiple menu items at once in WordPress?
- Customizing the a tag with Semantic UI
- How can I list all pages with their templates?
- Test if page is child and has children, if so echo child pages also on grandchild pages
- checkbox in post add/edit to add/remove the post from menu
- Put a wp_nav_menu inside another one
- Using custom post types in submenu + custom title
- Add Parent to List of Subpages
- I want only my sub-pages to be clickable in the navbar
- Ways to give a wp_list_pages menu link specific class names?
- How to make pages metabox display all hierarchy in menu admin?
- Moving Categories submenu to Media, but still opens Posts menu
- get all page IDs from wp_list_pages
- Category menu item and its last 10 posts as sub-menu
- Add class to the items in wp_list_pages
- How to show only parents subpages of current page item in vertical menu?
- Change ul class=”children” for wp_list_pages?
- Add items to a menu dynamically
- How to add active class to custom menu using while loop and wp_list_pages
- how to properly list child pages in sidebar?
- Generate a Menu that displays all child pages of top level parent
- How to display submenus on page based on referring top-level parent?
- Display grandchildren on child and grandchild pages using wp_list_pages
- Load parent pages when there are no child pages
- automatically adding submenu items