Add a login form in your front end

Add a login form in your front end

Written on: 07/10/2012

Hi guys and girls – ok, so last week, I had a situation where a client needed a login form for their subscribers, but they didn’t want users to have to go in via the WordPress default login area and end up at the Dashboard. So a simple solution was to create a login form in the front end of the site, which redirects a user to the homepage after login.

The code is below if you’d like to use it.

<form name="loginform" id="loginform" action="<?php bloginfo('url'); ?>/wp-login.php" method="post">
<input type="text" name="log" id="log" value="" size="20" tabindex="1" placeholder="Username" /><br class="clearme" />
<input type="password" name="pwd" id="pwd" value="" size="20" tabindex="2" placeholder="Password" /><br class="clearme" />
<label class="forgotten"><a href="<?php bloginfo('url'); ?>/wp-login.php?action=lostpassword">Forgotten Password?</a></label>
<input type="submit" class="signIn" name="submit" id="submit" value="SUBMIT" tabindex="3" />
<input type="hidden" name="redirect_to" value="<?php bloginfo('url'); ?>/" />
</form>

Nice and simple, but effective for what I wanted. There are more complex versions around that also hook the forgotten password side of things into the front end too, but I didn’t need to do that in this instance.

Let's work together on your project.

Have I made an impression?

If so, then why not take the next step, which is a totally free indicative quote calculator. My hand coded algorithm asks you a few simple questions, and then will be able to give you a ballpark figure that we can use as a jumping off point for your project. Get a free quote now