我想更改受保护帖子标题的颜色。当帖子处于受保护状态(具有密码)时,帖子标题将变为红色,与其他帖子不同。请帮帮我,谢谢。
更改受密码保护的帖子标题的颜色
1 个回复
最合适的回答,由SO网友:RiddleMeThis 整理而成
To change the color of password protected post titles in the admin
在您的主题或子主题中,将样式表排队以加载到管理中,然后添加一些简单的CSS以使用为受密码保护的帖子提供的类更改颜色。在主题的功能中。php。。。
function wpse_admin_styles(){
wp_enqueue_style(
\'admin_css\',
get_stylesheet_directory_uri() . \'/css/admin-styles.css\', array(), filemtime( get_stylesheet_directory() . \'/css/admin-styles.css\')
);
}
add_action(\'admin_enqueue_scripts\', \'wpse_admin_styles\');
创建css
目录中,添加管理样式。css并粘贴在以下css中。。。.post-password-required .row-title {
color: red;
}
To change the color of password protected post titles on the frontend
在主题或子主题中,将以下内容添加到CSS文件中,或直接添加到Appearance > Customize > Additional CSS
. 它使用添加到文章标记的类。.post-password-required .entry-title {
color: red;
}