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 can I customize the content of the login page?
- WordPress giving error when I log in after trying emergency.php
- WordPress keeps redirecting to an unsecure connection?
- A way to redirect users when they log in based on their current page
- Some crawlers/bots attempting to login with very good guesses. How?
- Cannot login in WordPress even after changing hash password in phpmyadmin
- Custom Field For Login
- User login without username, only password
- Creating login for client / customer that will take them to customized part of site
- Opening protected page with cookie?
- wp-login.php just refreshes the form fields
- WordPress login issue . Permission Problem
- Login just resets/reset password link also does not work
- How can I have customers log in using ONLY customer number? No password
- Users redirected to old site
- Problem with footer and login
- Create custom field for users to check if they agreed to terms
- WordPress logs out on protocol switch
- Improvements to “limit login attempts” plugin
- Add a required field to Registration
- wp_lostpassword_url not escaped
- WP login pages redirect to homepage (cannot login)
- Change “login/register” to “useraccount” when a user has logged in
- Create custom fields/meta data gender+country – radiobuttons and dropdown on register screen for these fields
- Remember me doesn’t work with www?
- How to place wp-login.php in page or page template?
- Webpage not found upon entering wrong username and password on custom login form?
- WordPress Login / SSL = Code Question
- loging to Admin page not working at all
- Can’t login through wp-login.php on fresh installation
- Is there any reason why there’s no “login_header” action at the login page?
- Simplest way to create two private sections each with a common account
- changing WordPress login page
- Shared user database trick not working
- WordPress Cookies – wp_set_auth_cookie
- Authenticate return value
- Hide wp-login.php but not the widget
- Register and Connect links: where are they located?
- Save user login date
- Login with Username (or Code) only