Can you post the contents of the PHP template where you call wp_nav_menu() to Pastebin and post the link here? You must pass an array to wp_nav_menu() even if there’s only one argument; are you doing that?
I did not pass any arguments with my function. From what you said, this could be the reason why it is not working. Here is my code that I have in my header file in my theme:
<div id="header">
<nav>
<?php echo wp_nav_menu(); ?>
</nav>
</div><!--header-->
Any help you could give me would be appreciated.
Thanks,
Truck35
If you don’t pass any arguments to wp_nav_menu(), WordPress will display the first menu (sorted alphabetically) with items assigned to it. Since I’m guessing this isn’t what you want, you should pass the theme_location argument to the function:
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
(It isn’t necessary to echo the results of the function.) Have you called register_nav_menu() to register a menu location? You’ll pass the location argument when you register a menu location, and you’ll pass the same string to theme_location when you call wp_nav_menu(). Is there a menu assigned to that location (Dashboard > Appearance > Menu > Manage Locations)?
Hi Mr. stephencottontail,
Thanks for the information. I’m going to try to pass an array as an argument as you suggested. Sorry for taking so long to reply, busy doing other things in addition to my IT stuff. I only echoed the function because it returns a Boolean value and I wanted to see if the function was working. I will post my result of the “wp_nav_menu()” function call with an array passed as an argument as soon as possible.
Thanks for your help it is really appreciated.
Bless,
Truck35