Skip to content

Instantly share code, notes, and snippets.

@webmasterninjay
Last active March 8, 2021 15:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmasterninjay/3f8c567eaa78cf440cdf1b73855ff0f7 to your computer and use it in GitHub Desktop.
Save webmasterninjay/3f8c567eaa78cf440cdf1b73855ff0f7 to your computer and use it in GitHub Desktop.
Customized Login page form in WordPress
<?php
// Customized login page
function theme_prefix_custom_login_page() {
$custom_logo_id = get_theme_mod( 'custom_logo' ); // image from cusomizer logo
$image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
$bg = get_stylesheet_directory_uri() . '/images/bg.jpg'; // change url to your preferred image
?>
<style type="text/css">
body.login {
background: url('<?php echo $bg; ?>') no-repeat center;
background-size: cover;
background-attachment: fixed;
display: grid;
align-content: center;
}
body.login div#login h1 a {
background: url('<?php echo $image['0']; ?>') no-repeat center;
background-size: 100%;
width: 320px;
}
body.login div#login {
background-color: rgba(255,255,255,0.8);
margin: 40px auto;
padding: 30px;
border: 1px solid #ddd;
border-radius: 3px;
}
body.login div#login .privacy-policy-page-link {
text-align: center;
width: 100%;
margin: 1em 0 1em!important;
}
</style>
<?php
}
add_action('login_enqueue_scripts','theme_prefix_custom_login_page');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment