Support » Fixing WordPress » wp_nav_menu – Sub-navigation based on page

  • Resolved FifeAirport



    I’m currently building a website for the first time using WordPress. I’m very novice with PHP and do this just as a hobby. I’ve gotten stuck trying to work out the new wp_nav_menu.

    This is my WIP here:

    If you go onto a page, eg I have added a sub navigation to the left sidebar. There are 5 of these different navigations, one for ‘Fife Airport’ and its children, ‘For Pilots’ and its children etc.

    I am currently using this script

    <div id="sidepanel">
      		$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      		$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      		if ($children) { ?>
      		<ul class="subnav">
      		<?php echo $children; ?>
      <?php }  ?>

    I’ve searched everywhere and have been Googling for the past 2 hours for a solution to this for wp_nav_menu. I’ve already created my custom menus in the admin panel, just need a way for only showing the menu for that page.

    The reason I’m wanting to use wp_nav_menu instead is so I can customise the titles of the pages to be different from the link text.

    Any solutions much appreciated.


Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_nav_menu – Sub-navigation based on page’ is closed to new replies.