-
-
Save AdsonCicilioti/c20c034b7e8847ca3e6e5f7d8c4c8e91 to your computer and use it in GitHub Desktop.
WordPress Frontend Login Page [UPDATED]
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 | |
/** | |
* Template Name: Login Page AA | |
* | |
* Login Page Template. | |
* | |
* @author Ahmad Awais | |
* @since 1.0.0 | |
*/ | |
get_header(); ?> | |
<!-- section --> | |
<section class="aa_loginForm"> | |
<?php | |
global $user_login; | |
// In case of a login error. | |
if ( isset( $_GET['login'] ) && $_GET['login'] == 'failed' ) : ?> | |
<div class="aa_error"> | |
<p><?php _e( 'FAILED: Try again!', 'AA' ); ?></p> | |
</div> | |
<?php | |
endif; | |
// If user is already logged in. | |
if ( is_user_logged_in() ) : ?> | |
<div class="aa_logout"> | |
<?php | |
_e( 'Hello', 'AA' ); | |
echo $user_login; | |
?> | |
</br> | |
<?php _e( 'You are already logged in.', 'AA' ); ?> | |
</div> | |
<a id="wp-submit" href="<?php echo wp_logout_url(); ?>" title="Logout"> | |
<?php _e( 'Logout', 'AA' ); ?> | |
</a> | |
<?php | |
// If user is not logged in. | |
else: | |
// Login form arguments. | |
$args = array( | |
'echo' => true, | |
'redirect' => home_url( '/wp-admin/' ), | |
'form_id' => 'loginform', | |
'label_username' => __( 'Username' ), | |
'label_password' => __( 'Password' ), | |
'label_remember' => __( 'Remember Me' ), | |
'label_log_in' => __( 'Log In' ), | |
'id_username' => 'user_login', | |
'id_password' => 'user_pass', | |
'id_remember' => 'rememberme', | |
'id_submit' => 'wp-submit', | |
'remember' => true, | |
'value_username' => NULL, | |
'value_remember' => true | |
); | |
// Calling the login form. | |
wp_login_form( $args ); | |
endif; | |
?> | |
</section> | |
<!-- /section --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment