You have the PHP IF statement needed, is_user_logged_in().
Just add your button to that and you should be good. Something this…
<?php if (is_user_logged_in()) {
echo '<button type="button" class="show-btn">LOG IN</button>';
} else {
echo '<button type="button" class="show-btn">REGISTER</button>';
}; ?>
Note: You have an extra </div> in your code above.
Related Posts:
- How to: PHP Log Out Link?
- Login/logout in header
- Check if user had autologin & if so, logout
- Log out without confirmation request (nonce)
- User registration followed by automatic login
- Adding “Remember Me” in custom login
- How to change the wp-login.php page title?
- How build a custom login/register form with error handling?
- How to log out everywhere else, destroy all sessions “all other devices”?
- Change the footer text on the login page
- Changing user_nicename
- Conditional Statement – check if post has an attachment image
- WordPress 4 invalid username special charachters issue
- How to place login logout link on menu that redirects users back to current page?
- How to turn off redirection from ‘domain.com/login’ to ‘domain.com/wp-login.php’
- How to resolve error “Cookies are blocked due to unexpected output.”?
- Trying to use Ternary operators with WP Conditionals
- Using a nonce in a Custom Login Form
- Constructing a custom login form using ajax
- automated tests as a user?
- How to do conditional publishing?
- Remove username in emails or swap username for email
- woocommerce and is_user_logged_in() if not redirect to homepage
- Check if user is logged in when clicking certain links on certain pages
- conditional statement for custom taxonomy
- PHP If user is logged in & on home page redirect
- WordPress shows registration link for non logged users
- Creating login session via CURL
- Admin username and password
- Add user settings to specific roles
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Recovering WP Login Credintials in Code?
- Create a new usermeta field for users
- Is it necessary to sanitize wp_set_password user input?
- WordPress custom login form using Ajax
- Redirect to a different page through registration, depending on page
- How to give new users two specific user role options upon WordPress user registration
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- What is the correct way to write this conditional statement?
- Wp-login appears White Screen, Error: Cannot modify header information
- Reordering Buddy Press profile navigation [closed]
- Why is my cookie not unsetting upon logout? [closed]
- User management system similar to wordpress one?
- Programmatic Login from 3rd Party site
- Cannot access wp-admin/wp-login.php (WordPress backend) anymore, what could be wrong?
- How to debug my custom login form looping intermittently
- getting logged in user info (wp-load.php) from parent directory
- Problem with login form
- Login to wordpress by clicking a link and specifying usernaname and password in url
- Is_front_page inside header.php is always returning true
- Log in / Log Out Custom Button
- Should `wp_login` be used since it’s deprecated?
- How to redirect users based on role and content of redirect_to?
- Advanced Custom Fields – display label and value only if value entered
- Change CSS based on is_user_logged_in
- PHP conditional script issue
- How to display login form anywhere, when user isn’t logged in, without redirecting?
- How can I open up my administrative panel to everyone?
- How to check if the current page is at a specified path in the URL?
- Add class to DIV depending on page loaded
- Force Users To Relogin
- How to hook a logout funtion for specific usr role in wordpress?
- How can I add a new row in a separate database when someone registers via WordPress?
- Can I set up a hover animation in CSS depending on a PHP conditional?
- One account with multiple logins
- Lost in trying to create user database system
- Logout redirects to default page
- Shortcode to log user into current URL
- Multidimensional Array
- Conditional featured image with youtube thumbnail
- PHP getting error when trying to access WP-Admin Dashboard
- I installed WordPress locally now how do I login?
- If user is logged in not working
- Change homepage content if user is logged in – BuddyPress
- How to make a conditional statement within $output in shortcodes.php?
- Show login greeting above sub-menu links?
- Conditionally remove comments and post meta in functions.php
- exclude custom post type from running a function
- include content within conditional statement?
- is_user_logged_in returning nothing on custom page
- Show label for value only when value exists, basic php
- Help with accessing wp-admin page and resolving error messages
- Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
- Can’t log in to WordPress wp-admin after adding code to functions.php
- Admin Panel 404 Error after login
- PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
- How to block specific user id in custom login form?
- Change button link to add nonce
- Conditional formatting on data fetched from MYSQL
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Call WP Rest-Api to GET /users/me returned NOTHING in console
- Find and print first entry from WordPress post in custom excerpt?
- Restrict wordpress access to logged users only
- Infinite loop when logging out using custom login form
- Menu not updating for logged in users after redirect
- Adding if statement
- how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
- Issues adding Recaptcha v3 to WordPress Registration
- Display specific page if user signed in
- Refresh page after login with litespeed cache