A-A+

如何修改WordPress登录页面

2017年09月23日 wordpress 如何修改WordPress登录页面已关闭评论 阅读 4,200 次浏览 次

如何将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://网址.cn';
}
add_filter( 'login_headerurl', 'custom_loginlogo_url' );

评论已关闭!

Copyright © 海边拾贝 保留所有权利.   Theme  Ality 鲁ICP备17020531号-1
网站已运行: | 耗时 0.490 秒 | 查询 53 次 | 内存 29.93 MB

用户登录