Are you looking for a way to add a custom login page in WordPress? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add a custom login page in WordPress.
Custom login pages are great when you have multiple users and want your entire site to stay “on brand.” The default WordPress login page can be changed with your brand name or logo.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
//Custom login page function clp_login_head() { echo '<style>'; //Begin custom styles echo '.login #nav a, .login #backtoblog a { color: # !important; }'; //Login page link color echo '.login h1 a { background:url("' . get_bloginfo('stylesheet_directory') . '/images/IMAGE GOES HERE"); width: px; height: px; }'; //Login page logo echo '.login .button-primary { background:#; border-color:#; }'; //Login page button color echo '</style>'; //End custom styles } add_action('login_head', 'clp_login_head');
You can change the CSS and image URL in the above code to add your custom styling for the WordPress login page.
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 27 best WordPress themes for travel blogs and how to secure your WordPress forms with password protection.
Comments Leave a Reply