In a previous post, How to Add a Custom Message on the Login or Register Screen, I talked about how to add a custom message to either the login screen or the register screen. Recently, I was asked how to create a custom message for logging out. Since WordPress uses the wp-login.php file to logout as well, then it isn't as simple as the last post.
So, to add a custom message to your logout screen, you need to add the following to your functions.php file.
[php]function custom_login_head() //outputs the CSS needed to blend custom-message with the normal message
{?>
<style type="text/css">
#login_error, .message { display:none; }
.custom-message {
-moz-border-radius:3px 3px 3px 3px;
border-style:solid;
border-width:1px;
margin:0 0 16px 8px;
padding:12px;
}
.login .custom-message {
background-color:#FFFFE0;
border-color:#E6DB55;
}
</STYLE><?php
}
add_action('login_head','custom_login_head');
function custom_logout_message() {
if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) //check to see if it's the logout screen
{
$message = "<p class='custom-message'>Custom logged out Message.</p><br />";
}
else //they are logged in
{
$message = "<p class='custom-message'>Custom Login Message.</p><br />";
}
return $message;
}
add_filter('login_message', 'custom_logout_message');[/php]