Login and Logout Link in WordPress
I want a link that says “login” and then changes to “logout” after the user has logged in.
This is easy to do with a little PHP code:
[sourcecode language='php'] <?php if(is_user_logged_in()) {
echo ‘<div id="login"><a title="Logout" href="’. wp_logout_url(‘index.php’) .’">Logout</a></div>’;
} else {
echo ‘<div id="login"><a title="Login" href="’. wp_login_url(‘wp-admin/index.php’) .’">Login</a></div>’;
} ?>[/sourcecode]
Random Posts
Twitter Feed
- No public Twitter messages.
Tags
android aweber backup book clubrunner dacdb email marketing facebook fbi foursquare functions gmail gmail filters gmail signatures google google buzz iPad iphone linkedin linux Local Marketing myspace newsletter openoffice os x polio plus prescott az prescott enews prescott young professionals press releases projects ratepoint Rotary Club search security seo social social media techcrunch tweetdeck twitter website speed windows wonderhowto wordpressSigma Web Technologies








