简体   繁体   中英

WordPress - Show custom logo on login screen

I'm trying to add a custom logo to my wordpress login form. I've a child theme active and I've used the following code inside my functions.php file, anyway the code will be ignored and I will see always the default wordpress logo. Is there something wrong in the code or I need to put this into the functions file of the parent theme?

function add_custom_logo(){
 ?>
  <style type="text/css">
    #login h1 a, .login h1 a {
        background-image: url('https://www.example.org/logo.png');
        height: 65px;
        width: 320px;
        background-size: auto;
        background-position: center center;
        background-repeat: no-repeat;
        padding-bottom: 30px;
     }
  </style>
 <?php
}
add_action('login_enqueue_scripts', 'add_custom_logo');

Most of the case, this cause by the priority issue - please change your action hook into this and try again:

add_action('login_enqueue_scripts', 'add_custom_logo', 99);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM