I've created a menu for each section of the site, and I'd like the sidebar to only show the relevant menu to pages in a section, so the 'About' page and its children receive the about menu and the 'Advice' page and its children the advice menu, and so on and so forth.
I've got this working for parent pages but I can't get it working with their children. I've tried various suggestions from around the internet but nothing seems to work correctly.
This code:
<?php if(is_page('advice')){
wp_nav_menu( array( 'theme_location' => 'advice-menu' ) );
} ?>
gets the correct menu in the correct section, but I need to extend it to cover child pages as well.
All menus are properly registered in both functions.php and Appearance > Menus and both the parent and child pages are all using the same page template.