分享互联网中的点点滴滴

如何将WordPress的logo替换为自己网站logo,并改变其外观,打造一个个性化的登录页面。
一、将下面代码加到主题functions.php模版文件的最后。

<?php   
function custom_login() {   
echo '<link rel="stylesheet" tyssspe="text/css" href="' . get_bloginfo('template_directory') . '/custom_login/custom_login.css" />'; }   
add_action('login_head', 'custom_login');   
?>

二、在所用主题中新建一个名称为:custom_login 的文件夹,并在其中新建:custom_login.css及制作好的网站logo.png也放进去。
三、将下面代码添加到custom_login.css中。

/** 背景及字体 **/    
html,body.login{   
    background:#f2f2f2;   
    font: 14px 'Microsoft YaHei', Arial, Lucida Grande, Tahoma, sans-serif;   
}   
/** 去掉链接下划线 **/    
html a{   
    text-decoration: none;   
}   
/** 登录DIV **/    
#login {   
    background:#fff;   
    border: 1px solid #ccc;   
    width:400px;   
    margin: 40px auto 0;   
    padding: 10px 10px 20px 10px;   
    border-radius:5px;   
    box-shadow:0 4px 10px -1px rgba(200, 200, 200, 0.7);   
}   
/** 替换logo **/    
.login h1 a{   
    background: #fff url(logo.png) no-repeat center;   
    width:400px;   
}   
/** 提示 **/    
.updated, .login .message {   
    background:#fff;   
    border: none;   
    text-align: center;   
}   
/** 表单 **/    
.login form {   
    box-shadow:none;   
    border: none;   
}   
#loginform, #registerform, #lostpasswordform{   
    background:transparent;   
    border:none;   
}   
/** 按钮 **/    
.button-primary,.submit .button-primary,#login form .submit input {   
    width:83px;   
    height:25px;   
    font-weight: bold;   
    border:none;   
}  

三、修改logo链接地址

function custom_loginlogo_url($url) {
return 'http://defcon.cn';
}
add_filter( 'login_headerurl', 'custom_loginlogo_url' );
本站所有文章、图片、资源等如无特殊说明或标注,均为来自互联网或者站长原创,版权归原作者所有;仅作为个人学习、研究以及欣赏!如若本站内容侵犯了原著者的合法权益,可联系我们进行处理,邮箱:250048111@qq.com
赞(0) 打赏
标签:

上一篇:

下一篇:

相关推荐

如果你觉得这篇文章对你有帮助,请赞助一下我吧。

支付宝扫一扫打赏

微信扫一扫打赏