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”?
- Changing user_nicename
- 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
- 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
- Create a new usermeta field for users
- Is it necessary to sanitize wp_set_password user input?
- 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?
- Wp-login appears White Screen, Error: Cannot modify header information
- Reordering Buddy Press profile navigation [closed]
- 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
- 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?
- Advanced Custom Fields – display label and value only if value entered
- Change CSS based on is_user_logged_in
- 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?
- 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?
- 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
- 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
- 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
- Adding if statement
- Display specific page if user signed in
- Refresh page after login with litespeed cache
- Redirect after login depending on the URL
- Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
- Redirecting the lost password page request when using a custon login page
- is_user_logged_in() not working in homepage
- Check if a user is logged into my WordPress site which is on a different server
- Newbie question. Login/Registration. New PHP page
- List users in a dropdown for login
- If else statement based on referral URL
- Not logged in when using http
- add bootstrap modal after login in wordpress
- If Month=Particular month display content [closed]
- White screen after login attempt
- Php conditional help needed
- Redirect users not logged in to the standard login page (and back) from some posts and pages
- How to replace wp-admin login page to another location?
- Not able to see the error [closed]
- Check user last login date
- Prevent users from display default wordpress login form
- login redirect based on user role not work as expected
- How to change wp-admin and wp-login urls
- wp_login_url always redirects me to wp-admin
- change div text and link for logged in users