By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,517 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,517 IT Pros & Developers. It's quick & easy.

2 Different Menus

P: 1
I have a wordpress blogsite that I have been working on and I have one question that I am needing help with. I am looking to have 2 menus, 1 for when a visitor is there and 1 for when a user is logged in. I have everything setup accordingly and I have referenced an extra menu in function.php. I am needing to edit the code under the header.php to get it to work. Currently the menu works when the user is logged in, but the menu that appears when nobody is logged in does not pull from the menu I created. It just displays every page on my site.

Here is the code under header.php that I currently have:

Expand|Select|Wrap|Line Numbers
  1. if (function_exists('wp_nav_menu')) {
  2.                         if(is_user_logged_in())
  3.                                       $primaryNav = wp_nav_menu( array( 'theme_location' => 'logged-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) ); 
  4.     } else {
  5. $primaryNav = wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) ); 
  6.                     };
I just need to fix this so that it works and references the menu I have for users that are not logged in. Thanks in advance!
Aug 11 '11 #1
Share this Question
Share on Google+
1 Reply


Death Slaught
100+
P: 1,137
This isn't an HTML or CSS question. Please ask in the PHP section.

Regards
Death
Aug 13 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.