全网影视免费看

美化wordpress登录页面

美化wordpress登录页面

WordPress后台的登录页面默认就是一个登录的表单,背景什么的都是白茫茫的一片。看久了还真有点腻。今天就分享一下美化后台登录界面的简易教程。

首先,打开你的主题的”functions.php”,拉倒最后面,在最后一行的 “?>” 前面添加如下代码:

/**
* WordPress 登录界面美化
**/
function custom_login_style() {
echo '<link rel="stylesheet" id="wp-admin-css" href="'.get_bloginfo('template_directory').'/admin-style.css" type="text/css" />';
}
add_action('login_head', 'custom_login_style');

B2模板子主题则添加此代码:

/**
* WordPress 登录界面美化
**/
function custom_login_style() {
echo '<link rel="stylesheet" id="wp-admin-css" href="'.B2_CHILD_URI.'/admin-style.css" type="text/css" />';
}
add_action('login_head', 'custom_login_style');

再在主题文件中新建一个css文件,命名为“admin-style.css”,css内容如下:

body{
font-family: "Microsoft YaHei", Helvetica, Arial, Lucida Grande, Tahoma, sans-serif;
width:100%;
height:100%;
background: url(http://img.infinitynewtab.com/InfinityWallpaper/2_14.jpg) no-repeat;
-moz-background-size: cover; /*背景图片拉伸以铺满全屏*/
-ms-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
}

/*顶部的logo*/
.login h1 a {
background:url(img/logo/TMTML-H.png) no-repeat;
background-size: 220px 50px;
width: 220px;
height: 50px;
padding: 0;
margin: 0 auto 1em;
border: none;
-webkit-animation: dropIn 1s linear;
animation: dropIn 1s linear;
}

/*登录框表单*/
.login form, .login .message {
background: #fff;
background: rgba(255, 255, 255, 0.3);
border-radius: 3px;
border: 1px solid #fff;
border: 1px solid rgba(255, 255, 255, 0.4);
-webkit-animation: fadeIn 1s linear;
animation: fadeIn 1s linear;
}

/*登录框输入框*/
.login label {
color: #000;
}
.login .message {
color: #000;
}
#user_login{
font-size: 18px;
line-height: 32px;
}

/* 返回博客与忘记密码链接 */
#backtoblog a, #nav a {
color: #fff !important;
display: inline-block;
-webkit-animation: rtol 1s linear;
animation: rtol 1s linear;
}

/*掉落的动画效果*/
@-webkit-keyframes dropIn {
0% {
-webkit-transform: translate3d(0, -100px, 0)
}
100% {
-webkit-transform: translate3d(0, 0, 0)
}
}
@keyframes dropIn {
0% {
transform: translate3d(0, -100px, 0)
}
100% {
transform: translate3d(0, 0, 0)
}
}

/*逐渐出现的动画效果*/
@-webkit-keyframes fadeIn {
from {
opacity: 0;
-webkit-transform: scale(.8) translateY(20px)
}
to {
opacity: 1;
-webkit-transform: scale(1) translateY(0)
}
}
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(.8) translateY(20px)
}
to {
opacity: 1;
transform: scale(1) translateY(0)
}
}

/*从右往左的动画效果*/
@-webkit-keyframes rtol {
from {
-webkit-transform: translate(80px, 0)
}
to {
-webkit-transform: translate(0, 0)
}
}
@keyframes rtol {
from {
transform: translate(80px, 0)
}
to {
transform: translate(0, 0)
}
}

你可以自由修改第5行的背景图片和第14行的logo图片。修改好后保存,并上传到当前主题的目录即可。

完了,就这么简单……

注:以上CSS样式有能力的可以自行DIY
本站福利,全网影视在线免费看 | 点击出发

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

提示:非实物交易,购买后不退款,请考虑好再购买 | 点此查看购买指南
售前咨询和售后服务,请点此联系作者咨询

给TA赞赏
共{{data.count}}人
人已赞赏
广告占位
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索