Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm creating a website which will provide services to members and I want to make it so that when a not logged in person comes to the website the menu is specifically designed for sales pages to make him register, but when a logged in person comes in he sees a different menu that is for the sole purpose of delivering the services. I want to make this because I don't want my already members always going to the website to read the sales pages. I would so appreciate your help, just can't figure this out on my own. And I think this would be pretty neat also :) hoping for an answer

share|improve this question
    
"use is_user_logged_in conditional tag and apply a different menu accordingly" Cool, but where do I put this? –  Gediminas Mar 4 '12 at 15:05
    
Search your themes templates until you find your menu. Then alter this with the code mentioned in the answer below. –  kaiser Mar 5 '12 at 1:02
add comment

1 Answer 1

You can do that by using 2 different menus (wp_nav_menu).

use is_user_logged_in conditional tag and apply a different menu accordingly:

if (is_user_logged_in()) {
      wp_nav_menu(array('theme_location' => 'logged_user' ));
} else {
      wp_nav_menu(array('theme_location' => 'new_user' ));
}

Edit This code goes where you'd usually put your regular menu in the theme - probably header.php

Also, make sure that you add the menus to the actual theme, i.e. in function.php add the folowing lines of code:

if (function_exists('register_nav_menu')):
    register_nav_menu('logged_user', 'Existing users menu');
    register_nav_menu('new_user', 'New users menu');
endif;
share|improve this answer
    
Dammit, just beat me to that exact same answer. Upvoted. –  Chris Cox Mar 4 '12 at 13:20
    
But where do I put this code in? –  Gediminas Mar 4 '12 at 14:38
    
@hannit_cohen where would I put this code in? I have a child theme, if that helps. –  Gediminas Mar 4 '12 at 15:14
    
Added the required code upside –  hannit cohen Mar 5 '12 at 13:31
1  
"But where do I put this code in?" only you can answer that question, as it is entirely dependent upon your Theme. See the wp_nav_menu() Codex entry that @hannitcohen linked in his answer. –  Chip Bennett Mar 5 '12 at 14:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.