login page customize
Published
2022-12-09
浏览次数 : 203

//customize the login page
function hh_custom_login_logo() {
//code to change logo
$login_style = '<style type="text/css">';
$login_style .= 'h1 a {
background:url("https://milad.com.cn/meiwen/wp-content/uploads/2022/12/pepsi-logo.jpeg") no-repeat center center/cover!important;}body.login {
background:url(https://images.unsplash.com/photo-1670537114426-c28a4e720ea5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80) no-repeat center center/cover!important;
}';
$login_style .= '</style>';
echo $login_style;
}
add_action('login_head', 'hh_custom_login_logo');
function hh_custom_footer_link() {
//append custom url link
echo '<p style="text-align:center"><a href="http://xmdn.net">跳转到最新教程</a></p> ';
}
add_action('login_footer', 'hh_custom_footer_link');
add_action('login_headerurl', 'custom_loginurl_togo');
function custom_loginurl_togo() {
return "http://xmdn.net";
}
//login message show before the logon form panel
add_filter('login_message', 'hh_custom_login_message');
function hh_custom_login_message() {
return "Custom honghua theme tutrorial to go";
}
//login errors
add_filter('login_errors', 'hh_custom_login_error');
function hh_custom_login_error($error) {
global $errors;
//empty_password,invalid_username,incorrect_password,empty_username
$error_code = $errors->get_error_codes();
/**
* $errors->get_error_codes()获取的是array,返回的有empty_password,invalid_username,incorrect_password,empty_username等四种结果
*/
$error_msg = '';
if (in_array("empty_password",$error_code)) {
# code...
$error_msg = "你的密码为空请输入密码";
}
if (in_array('invalid_username',$error_code)) {
# code...
$error_msg = "你的用户名不正确,打114咨询下";
}
if (in_array('incorrect_password',$error_code)) {
# code...
$error_msg = "你的密码不正确打个电话问下";
}
if (in_array('empty_username',$error_code)) {
# code...
$error_msg = "你的用户名为空";
}
return $error_msg;
//print_r($error_code);
}
- 标签1
- 标签1
- 标签1