WordPress后臺(tái)登錄界面比較簡(jiǎn)陋,如果直接去修改wp-login.php的樣式,勢(shì)必會(huì)導(dǎo)致下次升級(jí)WordPress版本的時(shí)候,所有的修改都恢復(fù)原樣,于是我們?cè)O(shè)法通過hook的方式來處理類似的修改,找到了如下完美的代碼:
function custom_login_logo() { echo '<style type="text/css"> h1 a { background-image:url(/wp-content/themes/eastdesign/images/login_logo.png) !important;background-size: auto !important;height: 80px !important;width: 271px !important; } html {background: #347edd;} body { font-family: PingHei,FZLTXHK,"Microsoft YaHei",Arial,Verdana,sans-serif!important;background: #347edd url(/wp-content/themes/eastdesign/images/login_background.jpg) center;} .login #backtoblog a, .login #nav a, .login h1 a {color: #fff;} .login form {border-radius: 10px;margin-top: 30px;background-color: #fff;border: 1px solid rgba(255, 255, 255, 0.7);box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.2);} .login label {color: #000;} .intl-tel-input .country-list .flag, .intl-tel-input .country-list .country-name {color:#000;} #major-publishing-actions input, #minor-publishing-actions .preview, #minor-publishing-actions input, #pass-strength-result, .login h1 {margin-top: 0;} .ds-icons-32 a.ds-renren,.ds-icons-32 a.ds-kaixin,.ds-icons-32 a.ds-douban {display: none;} </style>'; } add_action('login_head', 'custom_login_logo'); function my_login_logo_url() { return get_bloginfo( 'url' ); } add_filter( 'login_headerurl', 'my_login_logo_url' ); function my_login_logo_url_title() { return '雋永東方設(shè)計(jì)工作室'; } add_filter( 'login_headertitle', 'my_login_logo_url_title' );
只需將以上代碼加入模板目錄里邊的functions.php文件里邊保存即可。
具體效果如下: