How to add login form on WordPress Theme?

How to add login form on WordPress Theme?

Some bloggers want to add login form on WordPress theme for their author. Especially multiply author blogs need a Login form. To create or add login form on WordPress theme is not hard. Simply paste the following code where you would like to display your login form. You may add this login form codes in your sidebar.php file or create a page template.

<?php if (!(current_user_can('level_0'))){ ?>
<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="Login" 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']; ?>" /> 
<a href="<?php echo get_option('home'); ?>/wp-login.php?action=lostpassword">Recover password</a> 
<?php } else { ?>
<a href="<?php echo wp_logout_url(urlencode($_SERVER['REQUEST_URI'])); ?>">logout</a><br /> 
<a href="http://www.your-domain-name/wp-admin/">admin</a> <?php }?>

Find <a href=”http://www.your-domain-name/wp-admin/”>admin</a> and add your site admin url for redirect loged user to admin panel.
So now you know how easy to create a login form in WordPress theme without using any plugin.
Now you can add some css for adding style for your new created login from.

Tags: add login form on WordPress, wordpress wp login form, wordpress login form shortcode, wordpress login form plugin, wordpress login form on page, wordpress custom login form, wordpress login form widget, wordpress login plugin, wordpress register form

Masum Billah has written 326 articles

Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer. You may join with us to help other who want to learn web design and development. Thank you for stay with.

Recommended Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>