Edit WordPress Login page
Sometimes the Login page needs to be edited in some way. In my case, I needed to add a notice about the recpatcha security feature on the page. To edit the WordPress Login page, you need to edit the functions.php page.
What:
- WordPress 4.9.4
- Login page
The change the logo:
1. Create a new function called “new_custom_login_logo”
- This will just print out css code. (See below)
2. Edit and add the following code into the functions.php file. Make changes as necessary:
// Adds Changes to WordPress Login Page for YOURWESBITE.com
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/YOUR_LOGO_URL.jpg);
height:124px; /*Change this accordingly*/
width:150px; /*Change this accordingly*/
background-size: 150px 124px;
background-repeat: no-repeat;
padding-bottom: 5px;
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );
// This points the logo link to yoursite
function my_login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'my_login_logo_url' );
function my_login_logo_url_title() {
return 'YOU SITE NAME';
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );
/* THIS IS OPTIONAL, but I used this for people who click the Login button too early before the Recaptcha animation finishes*/
function my_loginfooter() { ?>
<p style="text-align: center; margin-top: 1em;">
<p style="text-align: center; color: #e40000; text-decoration: none; font-weight: bold;"> 1. Click the box next to "I'm not a robot" <br /> 2. WAIT UNTIL YOU SEE THE <u><font color="green">GREEN CHECK </font></u> before clicking Log In Button.
</p>
<?php }
add_action('login_footer','my_loginfooter');
ddd