CALL ME, IT'S QUICKER: 07540 221 386

Add a login form in your front end

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.