Using the [woocommerce_my_account]
shortcode, a user will see their account details if they’re logged in and if they’re not logged in, they’ll see a login and registration form.
Using the same page title “My Account” for these different users isn’t ideal because a user that has never created an account won’t naturally navigate to a “My Account” page in order to create an account.
A possible solution is to add the page that includes that shortcode twice to your navigation menu, name them “Login” and “My Account”, and give them separate classes:
Then we can control the visibility of the navigation links based on if a user is logged in:
add_action('wp_head','jg_user_nav_visibility');
function jg_user_nav_visibility() {
if ( is_user_logged_in() ) {
$output="<style> .nav-login { display: none; } </style>";
} else {
$output="<style> .nav-account { display: none; } </style>";
}
echo $output;
}
Related Posts:
- Updating usermeta from login redirect to billing address
- Separate registration and login for different roles
- SSO / authentication integration with external ‘directory service’
- How to prefill WordPress registration with social details
- WordPress registration message
- How to remove the WordPress logo from login and register page?
- Login email after registration never sent or received
- I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
- How do I check if a post is private?
- Receiving “This content cannot be displayed in a frame” error on login page
- How to customise wp-login.php only for users who are setting a password for the first time?
- What hooks should I use for pre-login and pre-registration actions?
- Change register form action url
- Problem with logging in WP users automatically
- How can I allow access to two user accounts using one login?
- Is it possible a one click user registration with Facebook or Twitter (or other Social Networks)?
- Register/Login using only phone number?
- Force users to register in order to view website [duplicate]
- How do I force “users must be registered and logged in” on subsites?
- auto login after registeration for wp-members plugin
- How To Change Wp Register/Login URL Permanently To My Custom Page
- How to modify the action attribute of the wp-login.php?action=register form?
- Correct passwords keep appearing as incorrect
- Disabling standard registration login with username/email and password?
- Login form doesn’t log in
- Get the url of custom login page in the registration page
- By registering always make uppercase the first letter of the login
- Show reCaptcha on Custom Frontend Login & Register Form [closed]
- Best option to implement external register/login to WP from self-made API
- Auto Login After Registration
- Disable all other page except index,register,login till user login
- What speaks against using a custom login.php / register.php to wordpress?
- How do I add Login fields and registration link to the header?
- How to make a user be able to register if such a login already exists?
- Sending new registration meta values to admin by email
- Are login functions considered part of the WP backend?
- WordPress registration page template
- Removing “public” user registration without completely turning it off?
- Disable registration on certain condition
- what is the best and safest way to allow users to register to site
- Updated : how to make email optional while user registration using default wordpress form
- Problem in auto login after registration
- How to invalidate `password reset key` after being used
- How do i Redirect specific user(WooCommerce Sign-in not wordpress admin page sign-in) to specific page
- Chosen user password in registration is not being accepted on Login
- WordPress auto login user after registration only from a specific page
- User account activation links are lacking query strings
- Login user after registration programmatically
- How to get rid of the username of registration form in theme my login wp plugin?
- Where do I find “log in” and “register” link which are located on the top right corner?
- How to force login after user browses for a few minutes or browses a few pages?
- Registration and Login form
- WordPress and Magento: let WordPress manage user registration and logins?
- redirect not logged in users to specific page and redirect them back where they come from
- how to add custom word press regisration form in word press 3.5 with out module [closed]
- Click on banner to register to the blog
- How to put Login, Register and newsletter widget on the same page?
- make a login system for site visitors
- How to create a fully functional user registration in WordPress?
- Remove login fields from /customer-account page [closed]
- How to login with email only no username?
- How do I change the logo on the login page?
- Why does WordPress hide the reset password key from the URL?
- How do I extend auto logout on idle OR redirect inline popup
- Positioning the “Lost your password?” and “← Back to Site”
- Warning: Cannot modify header information – headers already sent
- Validate Custom Login field
- Remove default user registration, login and subscriber profiles
- How to set different cookies for logged in admin users and logged in non admin users?
- Restricting frontend acess based on user role otherwise redirect to login form
- redirect to homepage after login
- “lambda_xx” on all wordpress login pages
- How to allow only certain users to login
- Login redirects and query strings
- Protect sequence of pages with same password for each of two groups of users
- Notifications when someone is on the site
- How to password-protect everything except the logo
- Generate email on meta value update
- Clients with empty username are not receiving request new password email
- Single Time Login HELP
- Allow Access to Home Page and Login Screen but Nothing Else (unless logged in)
- Reloading page with a query string upon login for admins
- force login loophole
- Custom login page problem!
- Looking up WordPress account information from Host or php files
- Multiple issues with Ajax login function due to browsers and cookies
- URL with login details included for public members
- Custom failed login error messages for users based on user role?
- Recognize custom login page as wp-login.php
- Can’t login to wordpress, got ERR_EMPTY_RESPONSE after a few minutes
- wp_signon works localhost but not wokrs https site
- Why deleting/removing cookies in WordPress does not log me out from admin?
- How to use google api for wordpress login
- display last login date in the frontend
- Woocommerce login to specific page or referrer
- Log in to wordpress after executing another form function
- Cannot login in WordPress even after changing hash password in phpmyadmin
- changing WordPress login page
- Check to see if there a wordpress user account and create one if not outside of wordpress
- How to disable login and registration pages?