WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] wp_nav_menu – Sub-navigation based on page

[Resolved] wp_nav_menu – Sub-navigation based on page

  • Hi,

    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: http://srv02.anthonylawrence.me.uk/scottD/wordpress/

    If you go onto a page, eg http://srv02.anthonylawrence.me.uk/scottD/wordpress/fife-airport/ 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

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

    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.

    MTIA

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