In my Facebook group a user asked:
I love all your posts. I'm looking for help for something simple. I have a membership site, and I need to swap out my secondary menu based on whether the visitor is logged in or not.
Here are the requirements:
- For non-logged in visitors, show
Login Menumenu in Secondary Navigation theme location. Add Login link automatically at the right.
- For logged in users, show
Member Linksmenu in Secondary Navigation theme location. Add Logout link automatically at the right.
For non-logged in visitors:
For logged in users:
At Appearance > Menus go to Manage Locations tab and assign a menu to Secondary Navigation Menu. It does not matter what menu this is. This is going to be replaced with one of the two custom menus you are going to create next.
Create two custom menus named
Login Menu and
Member Links and add your desired links. Note that the Login and Logout menu items are set to be automatically added.
Add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.