R
R
Rokis2015-11-17 17:10:37
css
Rokis, 2015-11-17 17:10:37

How to change styles of wp-login.php page?

1. Tried changing login.min.css - nothing happens.
2. I tried to connect my styles - only the picture changes and does not see the file update. Roughly speaking, on ftp I have this css:

.login h1 a {background-image: url('../login/logo.png');background-size: 160px!important 45px!important;width: 160px!important;height: 45px!important;}

On the page: wp-login.php?action=lostpassword is like this:
.login h1 a {
    background-image: url('../login/logo.png');
    background-size: 300px 260px;
    width: 300px;
    height: 260px;

The styles do not overlap, I updated the page, saved it in ftp, my file sees, the logo changes. I can't understand why.
I add styles like this:
function custom_login_css() {
echo '<link rel="stylesheet" type="text/css" href="'.get_stylesheet_directory_uri().'/login/login-styles.css" />';
}

add_action('login_head', 'custom_login_css');

Please tell me what I'm doing wrong or give alternative / working ways to change styles on wp.login.php pages ( without plugins ). I rummaged through 3 Google sheets for various requests - I did not find anything working.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
P
Pavel Chesnokov, 2015-11-17
@Rokis

function custom_login_logo() { 
?>
<style type="text/css">
body.login div#login h1 a {
    background-image: url(<?php echo get_bloginfo( 'template_directory' ) ?>/img/login_logo.png);
    margin-left: 0px;
    width: 300px;
    padding-bottom: 0px;
    margin-bottom: 0px;
    background-attachment: scroll;
    background-repeat: no-repeat;
    background-position: center top;
    background-size: auto;
}
</style>
<?php 
}
add_action( 'login_enqueue_scripts', 'custom_login_logo' );

function custom_login_logo_url() {
    return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'custom_login_logo_url' );

function custom_login_logo_url_title() {
    return 'my_login_logo_url_title';
}
add_filter( 'login_headertitle', 'custom_login_logo_url_title' );

K
Ksenia Mikhailova, 2015-11-17
@arizona

Connect the style file to the login_enqueue_scripts
hook And in login_head , it turns out that you need to connect inline styles

N
Nikolai Parotikov, 2015-11-17
@parotikov

And what, in fact, didn’t please you with plugins? Why edit WordPress files, it's not right-way?
If you fundamentally want your bike, then look at how it is done in the plugin and implement it in the same way. For example, Custom login

L
Loot, 2015-11-17
@Cesavel

What kind of nonsense? Why do you need to write a function and use a hook to add css? Yes, these are your tsmski

A
Anton Pozdnyakov, 2015-11-17
@Viccc

Tesla Login Customizer is good

V
Vahe, 2015-11-17
@vahe_2000

Try using get_info()insteadget_stylesheet_directory_uri()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question