I wanted to replace the wordpress logo which is displayed on login screen with some custom text.
Here is the code what I tried so far:
function my_custom_logo() {
echo '<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/wp-logo.png) !important; }';
}
add_action('admin_head', 'my_custom_logo');
It can replace the logo but what should I need to replace it with some text? Any suggestions to make it work?
4 Answers
You will first need to remove the wordpress logo from the login screen. The wordpress logo is added by css, so you will need to change the css and hook that to the login_enqueue_scripts
action hook
function my_login_logo() { ?>
<style type="text/css">
body.login div#login h1 a {
background-image: none;
background-size: 0 0;
height: 0;
margin: 0 auto 0;
width: 0;
}
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );
Next you can add your custom message
function custom_login_message() {
$message = "Your custom message goes here";
return $message;
}
add_filter('login_message', 'custom_login_message');
You can go and have a look at the codex for additional hooks and filters for the login form