3 Replies - 775 Views - Last Post: 20 June 2011 - 04:20 PM

#1 Moshambi  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 280
  • Joined: 20-November 07

WordPress Menu Problems...

Posted 15 June 2011 - 01:02 PM

Hello,

I am trying to add multiple WordPress menus to a theme. I have 3 total. Here is the code (explanation after):

functions.php
        function create_custom_menus() {
		register_nav_menus(Array(
					'nav-menu'=>__('Main Navigation'),
					'areas-of-practice'=>__('Areas Of Practice'),
					'footer-nav'=>__('Footer Navigation')
					));
	}
	add_action('init', 'create_custom_menus');




Other files:
<?php wp_nav_menu(array('menu'=>'nav-menu','container'=>false)); ?>
<?php wp_nav_menu(array('menu'=>'areas-of-practice','container'=>false)); ?>
<?php wp_nav_menu(array('menu'=>'footer-nav','container'=>false)); ?>



I have NO PROBLEMS with the first two menus, just the third one. It is like it is using the 'nav-menu' for the 'footer-nav' for some reason. I am stuck on what else to try doing in this situation...any of your guys help would be awesome!

Is This A Good Question/Topic? 0
  • +

Replies To: WordPress Menu Problems...

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4332
  • View blog
  • Posts: 12,126
  • Joined: 18-April 07

Re: WordPress Menu Problems...

Posted 16 June 2011 - 11:56 AM

I don't see any problem here in this code. You have registered the nav menu for "footer-nav" and you reference it correctly in the wp_nav_menu() call. Are you calling these one right after another? How are you calling the footer one in context of the file? Could it be an error in the theme that is causing it to show the wrong menu? Show us the file where you are putting footer-nav call.

:)
Was This Post Helpful? 0
  • +
  • -

#3 Moshambi  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 280
  • Joined: 20-November 07

Re: WordPress Menu Problems...

Posted 16 June 2011 - 02:39 PM

Thanks for the reply Martyr2, here is all the code from footer.php:


	<div id="footer">
		<div id="footer-nav">
			<?php wp_nav_menu(array('menu'=>'footer-nav','container'=>false)); ?>
		</div>
	</div>
</div>
</body>
</html>



Nothing crazy at all, I can include the other files too IF you think that could be the problem...doesn't make much sense to me why its not working.
Was This Post Helpful? 0
  • +
  • -

#4 Moshambi  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 280
  • Joined: 20-November 07

Re: WordPress Menu Problems...

Posted 20 June 2011 - 04:20 PM

SO I found a solution to this and thought I would post it here if anyone else ever has this problem.

I had to switch my syntax from:
<?php wp_nav_menu(array('menu'=>'footer-nav','container'=>false)); ?>


to this:
<?php wp_nav_menu(array('theme_location'=>'footer-nav','container'=>false)); ?>


Instead of 'menu' I had to use theme_location

Never knew about that, but it works now. Thanks again Martyr for at least looking!

This post has been edited by Moshambi: 20 June 2011 - 04:21 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1