Last active
May 13, 2017 06:56
-
-
Save djm56/17db2821f14b3482fbbee36fd0bb3b7f to your computer and use it in GitHub Desktop.
Simple Login and Logoff Link for WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* This checks if user is logged in | |
* If Logged in display logout link else display login link | |
* Also note the redirects to the login page and the home page. | |
* | |
*/ | |
<?php if (is_user_logged_in()) : ?> | |
<a href="<?php echo wp_logout_url(site_url( '/login/ ' )); ?>">Logout</a> | |
<?php else : ?> | |
<a href="<?php echo wp_login_url(home_url()); ?>">Login</a> | |
<?php endif;?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment