覆盖wp-login.php样式 [英] Override wp-login.php styles

查看:72
本文介绍了覆盖wp-login.php样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Wordpress CMS网站,其中大多数标签都需要为白色.因此,主题在每个表单标签中包含以下样式.

I have a Wordpress CMS website where most labels are needed to be white. So the theme includes the below styles per form labels.

.login label {
    color: #fff;
    font-size: 14px;
}

上面的样式是从/wp-login.php文件中填充的-样式本身位于login.min.css中(直接包含在wp-login.php中)

This above style is populated from within /wp-login.php file -- the style itself is located in the login.min.css (which is included directly within wp-login.php)

对于忘记密码屏幕,我只需要覆盖它.

I need to override this ONLY for the forget password screen.

幸运的是,有两个标签的自定义ID选择器,在这种情况下,我需要为黑色. #pass1 #pass2

Luckily there are custom ID selectors for the two labels I need to be black in this instance. #pass1 #pass2

我的问题是,我对/wp-login.phplogin.min.css没有访问权限-我尝试添加!important并在header.php中声明这两个选择器,但未读取它们.

My problem is, I have NO ACCESS to /wp-login.php and login.min.css -- I have tried adding !important and declaring these two selectors within header.php but they were not read.

我需要以某种方式添加;在当前允许的情况下.

I need to somehow add; with current permission situation.

#pass1 { color: #000 !important; }

#pass2 { color: #000 !important; }

我可以使用header.phpfooter.php中的jQuery附加样式吗?会读吗?

Could I use jQuery from header.php or footer.php to append the style? Would it be read?

推荐答案

编辑任何wp核心文件不是最佳实践,因此我建议还是不要触摸wp-login.php,因为更新WordPress可以重置内容.

It's not best practice to edit any wp core files, so I'd advice not to touch wp-login.php anyway, since updating WordPress can reset things.

相反,将其添加到您的functions.php中:

Instead, add this to your functions.php:

 // Custom login
function custom_login() {
        $files = '<link rel="stylesheet" href="'.get_bloginfo('template_directory').'/css/login.css" />';
        echo $files;
}
add_action('login_head', 'custom_login');

这篇关于覆盖wp-login.php样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆