latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Alternate Menu for members – part 2

Home Forums Community Forum Alternate Menu for members – part 2

This topic contains 4 replies, has 4 voices. Last updated by  Raam Dev 4 years, 9 months ago.

Topic Author Topic
Posted: Friday Mar 16th, 2012 at 6:18 am #8350
Deyson Ortiz
Username: deyson

Hello Christian, I guess I forgot to click on the notify by email for your reply to: http://www.s2member.com/forums/topic/alternate-menu-for-members/

Could you please explain how I can add this to my navigation bar.

For example: http://www.motion-master-templates.com, when the member is logged in, I would like the “Membership” navigation button to gone since they will not need it anymore.

Let me know if this is possible. I saw the code, thank you, but I am a very much a novice, so I am clueless on where to start.

Thank you very much for your time.

Have an awesome day!

p.s. I click on the notify me via email button. :)

List Of Topic Replies

Viewing 4 replies - 1 through 4 (of 4 total)
Author Replies
Author Replies
Posted: Friday Mar 16th, 2012 at 3:16 pm #8402

Hello Deyson,

There are a few things you need to do to achieve this.
You will need two different menus so first we need to register support for two menus in your functions.php file.
Depending on the theme your using you will have some code like the following:

// This theme uses wp_nav_menu() in one location.
	register_nav_menu( 'primary', __( 'Primary Menu' ) );

you will need to add or replace with

register_nav_menu( 'logged-in-menu', __( 'logged-in-menu') );
register_nav_menu( 'logged-out-menu', __( 'logged-out-menu') );

then in your header.php file replace

<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>

with

<?php
if ( is_user_logged_in() ) {
    wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) );
} else {
    wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) );
}
?>

Then in wordpress admin appearance > menus, you should see that under theme locations you have support for two or more menus. Now you can create a menu for logged in users and one for users that are not and apply them to the relevant drop down menus under theme locations.

I’m assuming a few things here so if your theme does not work in this way I can talk you through an alternative or if anything I have said don’t make sense let me know and I will try and explain better.

Posted: Tuesday Mar 20th, 2012 at 1:12 am #8569
Staff Member
@Philly Forum rank/icon updated. Helpful/Experienced awards granted.
Thanks for your continued involvement!
Posted: Tuesday Mar 20th, 2012 at 2:09 pm #8632
Deyson Ortiz
Username: deyson

Hello Philly. Thank you!!!! It works and it is awesome.

Have an awesome day!!

P.S. I am not getting my email notifications :( I was before.

Posted: Friday Mar 23rd, 2012 at 1:16 pm #8935
Raam Dev
Username: Raam
Staff Member

Thank you for the update, Deyson! Glad to hear it’s working!

Viewing 4 replies - 1 through 4 (of 4 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.