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

 

Comments are closed.