Last active
June 26, 2021 06:34
-
-
Save rdimascio/453757df8e62d52272bd8ab3e965ae2b to your computer and use it in GitHub Desktop.
This file contains 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 | |
// Include Main Stylesheet on Login Page | |
function my_custom_login() { | |
echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/assets/css/main.min.css" />'; | |
} | |
add_action('login_head', 'my_custom_login'); | |
// Add title to Login page | |
function custom_login_title($origtitle) { | |
return get_bloginfo('name') . ' Login'; | |
} | |
add_filter('login_title', 'custom_login_title', 99); | |
// Add message to Login page | |
function custom_login_message() { | |
$message = "<h1 class=\"login-title\">Login</h1><p class=\"login-message\">Welcome back.</p>"; | |
return $message; | |
} | |
add_filter('login_message', 'custom_login_message'); | |
// Remove the WP default "shake" animation from Login page | |
function remove_loginshake() { | |
remove_action('login_head', 'wp_shake_js', 12); | |
} | |
add_action('login_head', 'remove_loginshake'); | |
// Change WP default error message on Login page | |
function login_error_override() { | |
return 'Invalid email or password'; | |
} | |
add_filter('login_errors', 'login_error_override'); | |
// Automatically check the "Remember Me" on Login page | |
function login_checked_remember_me() { | |
add_filter( 'login_footer', 'rememberme_checked' ); | |
} | |
add_action( 'init', 'login_checked_remember_me' ); | |
function rememberme_checked() { | |
echo "<script>document.getElementById('rememberme').checked = true;</script>"; | |
} | |
// Change the Password label on Login page | |
function change_labels( $translated_text, $text, $domain ) { | |
if ( 'Password' === $text ) { | |
$translated_text = 'Password <a id="pw_forgot" href="/">Forgot?</a>'; | |
} | |
return $translated_text; | |
} | |
function register_change_labels_filter() { | |
add_filter( 'gettext', 'change_labels', 20, 3 ); | |
} | |
add_action( 'login_head', 'register_change_labels_filter' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment