Wordpress: Login form for your themes


/ Published in: PHP
Save to your folder(s)

Add a login form to your wordpress themes frontend.


Copy this code and paste it in your HTML
  1. /**
  2. * Usage: add user_login_form(); to your theme somewhere.
  3. *
  4. *
  5. */
  6.  
  7.  
  8. function user_login_form(){ ?>
  9. <form id="loginform" action="<? echo site_url('wp-login.php', 'login_post') ?>" method="post">
  10. <ul id="login_list">
  11. <li>
  12. <label for="user_login">Username / Email Address
  13. <input type="text" name="log" id="user_login" class="input round" value="<?php echo esc_attr($user_login); ?>" />
  14. </label>
  15. </li>
  16. <li>
  17. <label for="user_pass">Password
  18. <input type="password" name="pwd" id="user_pass" class="input round" value="" />
  19. </label>
  20. </li>
  21. <? do_action('login_form'); ?>
  22. <li class="rememberme-check-box">
  23. <input name="rememberme" type="checkbox" id="rememberme" value="forever" />&nbsp;Remember you?
  24. <input type="hidden" name="redirect_to" value="<?php echo esc_attr(get_option('home')); ?>/?action=user" />
  25. </li>
  26.  
  27.  
  28. <li class="submit">
  29. <a href="<? echo get_option('home'); ?>/?action=user" title="Lost your password? Reset it here..." class="button" id="password-reset">
  30. Forgot Your Password?
  31. </a>
  32. <input class="button" type="submit" id="signin" value="Sign In" />
  33. </li>
  34. </ul>
  35. </form>
  36.  
  37.  
  38. <? }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.