Created
July 7, 2016 16:36
-
-
Save alokstha1/04c1f056c31bbd452bf3062edb53fa60 to your computer and use it in GitHub Desktop.
User Login form Front End WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php function login_form_frontend($args = array()) { | |
$defaults = array('echo' => true, | |
'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], // Default redirect is back to the current page | |
'form_id' => 'loginformfrontend', | |
'label_username' => __('Username'), | |
'label_password' => __('Password'), | |
'label_remember' => __('Remember Me'), | |
'label_log_in' => __('SIGN IN'), | |
'id_username' => 'user_login', | |
'id_password' => 'user_pass', | |
'id_remember' => 'rememberme', | |
'id_submit' => 'wp-submit', | |
'remember' => false, | |
'value_username' => '', | |
// 'value_remember' => false, // Set this to true to default the "Remember me" checkbox to checked | |
); | |
$args = wp_parse_args($args, apply_filters('login_form_defaults', $defaults)); | |
$form = ' | |
<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url(site_url('wp-login.php', 'login_post')) . '" method="post" > | |
' . apply_filters('login_form_top', '', $args) . '<fieldset> | |
<label><i class="fa fa-user"></i> Login Form</label> | |
<input type="text" name="log" id="' . esc_attr($args['id_username']) . '" class="input-field" value="' . esc_attr($args['value_username']) . '" size="20" placeholder="Email Address" /> | |
<input placeholder="Password" type="password" name="pwd" id="' . esc_attr($args['id_password']) . '" class="input-field" value="" size="20" /> | |
<input type="submit" name="wp-submit" id="' . esc_attr($args['id_submit']) . '" class="button" value="' . esc_attr($args['label_log_in']) . '" /> | |
<input type="hidden" name="redirect_to" value="' . esc_url($args['redirect']) . '" />' . apply_filters('login_form_middle', '', $args) . ' | |
' . apply_filters('login_form_bottom', '', $args) . ' | |
</fieldset></form>'; | |
if ($args['echo']) | |
echo $form; | |
else | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment