Add a Login Form Anywhere In Your WordPress Theme
By default, you can add a “Meta” widget to your WordPress blog in any sidebar that will link to where you can login or log out, as well as display a link to the dashboard. What if you just wanted to skip clicking that extra link, and just login straight from a form on your blog. Well, just add the code below to wherever you would like the form to be displayed, and that’s it.
[php]
<?php if (!(current_user_can(‘level_0′))){ ?>
<h2>Login</h2>
<form action="<?php echo get_option(‘home’); ?>/wp-login.php" method="post">
<input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="20" />
<input type="password" name="pwd" id="pwd" size="20" />
<input type="submit" name="submit" value="Send" class="button" />
<p>
<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
</p>
</form>
<a href="<?php echo get_option(‘home’); ?>/wp-login.php?action=lostpassword">Recover password</a>
<?php } else { ?>
<h2>Logout</h2>
<a href="<?php echo wp_logout_url(urlencode($_SERVER['REQUEST_URI'])); ?>">logout</a><br />
<a href="http://XXX/wp-admin/">admin</a>
<?php } ?>
[/php]
Source: Add a Login Form on Your WordPress theme
Related Articles
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








