I've created a wordpress menu with wp_nav_menu. How do I get my submenu (layout on the right of my child pages) to echo the main navigation of that page(so it shows child links of the page you are on) and include custom links?

At the moment I have this which does show all child pages of a parent page but completely ignores any custom links i add in the wp_nav_menu navigation, which i understand is because it is looking at the page hierarchy instead:

<body>
<!--sub menu side bar -->
        <?php 
        $PageArray = get_pages(array(
            'child_of' => get_the_ID()
        ));

        if ($theParent or $PageArray) { ?>
        <div class="page-links">
          <h2 class="page-links__title"><a href="<?php echo get_permalink($theParent); ?>"><?php echo get_the_title($theParent); ?></a></h2>
          <div class="wave_page-links"></div>
          <ul class="min-list">
            <?php
                if ($theParent) {
                    $findChildrenOf = $theParent;
                } else {
                    $findChildrenOf = get_the_ID();
                }
                wp_list_pages(array(
                    'title_li' => NULL,
                    'child_of' => $findChildrenOf,
                    'sort_column' => 'menu_order', /*change page order in page attributes*/
                ));
            ?>
          </ul>
        </div>
        <?php } ?>

0 Answers