Monday, January 21, 2013

[WordPress] Custom Login, Logout Links

Problem:
How to create custom login and logout links for a WordPress Template.

Solution:
<?php
if(is_user_logged_in())
{
echo '<a class="logout" title="Logout" href="'. wp_logout_url('index.php') .'">Logout</a>';
}
else
{
echo '<a class="login" title="Login" href="'. wp_login_url('index.php') .'">Login</a>';
}
?>

No comments:

Post a Comment