I have this loop that simply shows all child pages of the current page:
<?php
$args = array(
'parent' => $post->ID,
'post_type' => 'page',
'sort_order' => 'ASC'
);
$pages = get_pages($args); ?>
<?php foreach( $pages as $page ) { ?>
<div>
<p><?php echo $page->post_title; ?></p>
</div>
<?php } ?>
The Nav for this page looks like this:
Parent Page
- Child page
- Child page
- Child page
- Custom Link (added in appearance > menus)
- Custom link (added in appearance > menus)
- Page which has another parent (added in appearance > menus)
The code above correctly shows all of the direct child pages, but I would like it to show the custom links and other page I have added to the menu dropdown.
Ive tried playing with wp_get_nav_menu_items
in place of get_pages
and also using 'post_type' => 'page'
but I can't seem to get this working correctly. I can either show a full list of all pages or just the direct child pages.
Can anyone tell me where I'm going wrong please? I seems like it should be a really easy thing to do...