Created
January 10, 2024 03:42
-
-
Save bacoords/9c58b39de36cacec5be306b66f307c12 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Custom login page design | |
*/ | |
function custom_login_page_design() { | |
$colors = wp_get_global_styles( array( 'color' ) ); | |
$variables = wp_get_global_stylesheet( array( 'variables' ) ); | |
?> | |
<style type="text/css"> | |
<?php echo esc_html( $variables ); ?> | |
body.login { | |
background-color: <?php echo esc_attr( $colors['background'] ); ?>; | |
color: <?php echo esc_attr( $colors['text'] ); ?>; | |
} | |
</style> | |
<?php | |
$custom_logo_id = get_theme_mod( 'custom_logo' ); | |
if ( $custom_logo_id ) { | |
$image = wp_get_attachment_image_src( $custom_logo_id, 'medium' ); | |
?> | |
<style type="text/css"> | |
#login h1 a, .login h1 a { | |
background-image: url(<?php echo esc_attr( $image[0] ); ?>); | |
height:<?php echo esc_attr( $image[2] ); ?>px; | |
width:<?php echo esc_attr( $image[1] ); ?>px; | |
max-width: 100%; | |
background-size: contain; | |
background-repeat: no-repeat; | |
padding-bottom: 30px; | |
} | |
</style> | |
<?php | |
} | |
} | |
add_action( 'login_enqueue_scripts', 'custom_login_page_design' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment