Wordpress

修改后台登录样式

陈雷 · 11月23日 · 2019年 · · ·

先上图,这是我的后台登录样式,下面分享给大家。

首先建立一个简单的随机诗歌库js文件,忘记是在哪儿找到的这段代码了:

function text() { 
};
text = new text(); 
number = 0; 
// textArray 
text[number++] = "山有木兮木有枝,心悦君兮君不知。</br><span>——佚名《越人歌》</span>" 
text[number++] = "人生若只如初见,何事秋风悲画扇。</br><span>——纳兰性德《木兰词·拟古决绝词柬友》</span>" 
text[number++] = "十年生死两茫茫,不思量,自难忘。</br><span>——苏轼《江城子·乙卯正月二十日夜记梦》</span>" 
text[number++] = "曾经沧海难为水,除却巫山不是云。</br><span>——元稹《离思五首·其四》</span>" 
text[number++] = "人生如逆旅,我亦是行人。</br><span>——苏轼《临江仙·送钱穆父》</span>" 
text[number++] = "玲珑骰子安红豆,入骨相思知不知。</br><span>——温庭筠《南歌子词二首 / 新添声杨柳枝词》</span>" 
text[number++] = "只愿君心似我心,定不负相思意。</br><span>——李之仪《卜算子·我住长江头》</span>" 
text[number++] = "平生不会相思,才会相思,便害相思。</br><span>——徐再思《折桂令·春情》</span>" 
text[number++] = "入我相思门,知我相思苦。</br><span>——李白《三五七言 / 秋风词》</span>" 
text[number++] = "两情若是久长时,又岂在朝朝暮暮。</br><span>——秦观《鹊桥仙·纤云弄巧》</span>" 
text[number++] = "山无陵,江水为竭。冬雷震震,夏雨雪。</br>天地合,乃敢与君绝。</br><span>——佚名《上邪》</span>" 
text[number++] = "愿得一心人,白头不相离。</br><span>——卓文君《白头吟》</span>" 
text[number++] = "雨打梨花深闭门,孤负青春,虚负青春。</br><span>——唐寅《一剪梅·雨打梨花深闭门》</span>" 
text[number++] = "去年今日此门中,人面桃花相映红。</br><span>——崔护《题都城南庄》</span>" 
text[number++] = "人生自是有情痴,此恨不关风与月。</br><span>——欧阳修《玉楼春·尊前拟把归期说》</span>" 
text[number++] = "花自飘零水自流。一种相思,两处闲愁。</br><span>——李清照《一剪梅·红藕香残玉簟秋》</span>" 
text[number++] = "一日不见兮,思之如狂。</br><span>——司马相如《凤求凰 / 琴歌》</span>" 
text[number++] = "少年不识愁滋味,爱上层楼。</br>爱上层楼。为赋新词强说愁。</br><span>——辛弃疾《丑奴儿·书博山道中壁》</span>" 
text[number++] = "身无彩凤双飞翼,心有灵犀一点通。</br><span>——李商隐《无题·昨夜星辰昨夜风》</span>" 
text[number++] = "世间无限丹青手,一片伤心画不成。</br><span>——高蟾《金陵晚望》</span>" 
text[number++] = "问世间,情为何物,直教生死相许?</br><span>——元好问《摸鱼儿·雁丘词 / 迈陂塘》</span>" 
text[number++] = "滚滚长江东逝水,浪花淘尽英雄。</br><span>——杨慎《临江仙·滚滚长江东逝水》</span>" 
text[number++] = "春宵一刻值千金,花有清香月有阴。</br><span>——苏轼《春宵·春宵一刻值千金》</span>" 
text[number++] = "林花谢了春红,太匆匆。</br>无奈朝来寒雨,晚来风。</br><span>——李煜《相见欢·林花谢了春红》</span>" 
text[number++] = "一往情深深几许?深山夕照深秋雨。</br><span>——纳兰性德《蝶恋花·出塞》</span>" 
text[number++] = "执子之手,与子偕老。</br><span>——佚名《击鼓》</span>" 
text[number++] = "自在飞花轻似梦,无边丝雨细如愁。</br><span>——秦观《浣溪沙·漠漠轻寒上小楼》</span>" 
text[number++] = "春风得意马蹄疾,一日看尽长安花。</br><span>——孟郊《登科后》</span>" 
text[number++] = "此情可待成追忆,只是当时已惘然。</br><span>——李商隐《锦瑟》</span>" 
text[number++] = "一生大笑能几回,斗酒相逢须醉倒。</br><span>——岑参《凉州馆中与诸判官夜集》</span>" 
text[number++] = "菩提本无树,明镜亦非台。</br><span>——惠能《菩提偈》</span>" 
text[number++] = "一声梧叶一声秋,一点芭蕉一点愁,</br>三更归梦三更后。</br><span>——徐再思《水仙子·夜雨》</span>" 
text[number++] = "思悠悠,恨悠悠,恨到归时方始休。</br><span>——白居易《长相思·汴水流》</span>" 
text[number++] = "人面不知何处去,桃花依旧笑春风。</br><span>——崔护《题都城南庄》</span>" 
text[number++] = "时光只解催人老,不信多情,长恨离亭,</br>泪滴春衫酒易醒。</br><span>——晏殊《采桑子·时光只解催人老》</span>" 
text[number++] = "昨夜西风凋碧树,独上高楼,</br>望尽天涯路。</br><span>——晏殊《蝶恋花·槛菊愁烟兰泣露》</span>" 
text[number++] = "浮云一别后,流水十年间。</br><span>——韦应物《淮上喜会梁川故人 / 淮上喜会梁州故人》</span>" 
text[number++] = "疏影横斜水清浅,暗香浮动月黄昏。</br><span>——林逋《山园小梅·其一》</span>" 
text[number++] = "若是前生未有缘,待重结、来生愿。</br><span>——乐婉《卜算子·答施》</span>" 
text[number++] = "抽刀断水水更流,举杯消愁愁更愁。</br><span>——李白《宣州谢脁楼饯别校书叔云 / 陪侍御叔华登楼歌》</span>" 
text[number++] = "云想衣裳花想容,春风拂槛露华浓。</br><span>——李白《清平调·其一》</span>" 
text[number++] = "君埋泉下泥销骨,我寄人间雪满头。</br><span>——白居易《梦微之》</span>" 
text[number++] = "取次花丛懒回顾,半缘修道半缘君。</br><span>——元稹《离思五首·其四》</span>" 
text[number++] = "休对故人思故国,且将新火试新茶。</br>诗酒趁年华。</br><span>——苏轼《望江南·超然台作》</span>" 
text[number++] = "溪云初起日沉阁,山雨欲来风满楼。</br><span>——许浑《咸阳城东楼 / 咸阳城西楼晚眺 / 西门》</span>" 
text[number++] = "行到水穷处,坐看云起时。</br><span>——王维《终南别业 / 初至山中 / 入山寄城中故人》</span>" 
text[number++] = "近水楼台先得月,向阳花木易为春。</br><span>——苏麟《断句》</span>" 
text[number++] = "似此星辰非昨夜,为谁风露立中宵。</br><span>——黄景仁《绮怀》</span>" 
text[number++] = "夜月一帘幽梦,春风十里柔情。</br><span>——秦观《八六子·倚危亭》</span>" 
text[number++] = "仰天大笑出门去,我辈岂是蓬蒿人。</br><span>——李白《南陵别儿童入京》</span>" 
// 可以往下一直添加
increment = Math.floor(Math.random() * number); 
document.write('<div class="shige">'+text[increment]+'</div>'); 

然后在自定义function文件里加入如下代码:

function custom_login_logo() { 
echo '
	<style>
	body{
	background-color:#f2f2f2;
	}
.shige {
    width: 100%;
    height: auto;
    position: relative;
    margin: 0 auto;
    text-align: center;
    top: 30%;
    font-size: 24px;
    line-height: 2;
}
.shige span{
	line-height: 5;
    font-size: 16px;
    margin-left: 200px;
}

#login {
    width: 350px;
	margin: 0;
    padding:0;
    position: absolute;
    bottom: 50px;
    right: 100px;
}
.login h1,#nav,#backtoblog {
    display:none;
}
.login form {
    margin: 0;
    padding: 0;
    font-weight: 400;
    background: none;
    border: none;
	box-shadow:none;
}
.login form label,.forgetmenot{
	display:none;
}
.login form .input, .login input[type=password], .login input[type=text] {
    font-size: 14px;
    line-height: 1;
    width: 39%;
    border-width: 1px;
    padding: 0 10px;
    margin: 0 10px 0 0;
    min-height: 30px;
    max-height: none;
    float: left;
}
.login .button.wp-hide-pw {
    line-height: 3;
    margin: 0;
    padding: 0;
    right: 65px;
}
.wp-core-ui .button-group.button-large .button, .wp-core-ui .button.button-large {
    padding: 0 12px 0px;
}
	</style>
	';
echo '<script src="插入随机诗歌js文件地址"></script>';
}
add_action('login_head', 'custom_login_logo');

这样就成了,有兴趣的小伙伴可以多写点自己喜欢的诗文进去,也可以调整诗文展示的样式。

0 条回应