Sometimes we want to display a different button for when you are logged-in (logged-in state) and another for when you are not.. (See pictures)
![]()
![]()
/*we figure out if user is logged in? If not logged in, show login button, else show logout button */
<?php if (is_user_logged_in()){
<a class="logoutbtn" href="http://<yoursitename>/ wp-login.php?logout"> logout </a>
}
else {
<a class="loginbtn" href="http://<yoursitename>/ wp-login.php"> login </a>
};
?>
Instead of styling the link classes, you can also just change the text message to say whatever you want.
one
comment
Thank you for the lovely invite to come see your new look. Whiuch by the way is fabulous. Of course it was lovely before. But, it always feels good to get a make over huh? You did an excellent job. And Happy Halloween to you also!! Blessings of peace!