My client is looking for a way to have a Sign up/Login button outside the header menu area.
For instance this website – https://poshmark.com/ . The “sign up with email” forwards to a login form which is the same as woocommerce login form.
If i do this with a simple button – even after registration or login, the button will show the original text (ex. “login/register”), but the My account/Login/Register will show the user login name (ex. “customer name1”).
All in all i want to copy the exact button in the main body of my website.
I know this is simple for you, but i am really struggling here.
Thank you in advance!
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You can try wp_loginout() function which will display Login or Logout text (based on whether the user is logged in or not) in an anchor tag. And, then you can apply CSS styling to make the anchor tag to appear like a button. Hope this logic helps you.
See here for reference.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0