wp admin - Change the color of the Password Protected Post titles

I want to change the color of the protected post titles. When a post is in protected status (have password), the post ti

I want to change the color of the protected post titles. When a post is in protected status (have password), the post title will turn red different from other posts. Please help me, thanks.

I want to change the color of the protected post titles. When a post is in protected status (have password), the post title will turn red different from other posts. Please help me, thanks.

Share Improve this question edited Aug 6, 2019 at 19:16 RiddleMeThis 3,8078 gold badges22 silver badges30 bronze badges asked Aug 6, 2019 at 18:49 Duy HữuDuy Hữu 195 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 1

To change the color of password protected post titles in the admin

In your theme or child theme, enqueue a stylesheet to load in the admin, then add some simple CSS to change the color using the class that is given to password protected posts.

In your theme's functions.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');

Create a css directory in your theme, add the admin-styles.css and paste in the following CSS...

.post-password-required .row-title {
    color: red;
}

To change the color of password protected post titles on the frontend

In your theme or child theme add the following to your CSS files, or add it directly in Appearance > Customize > Additional CSS. It uses a class added to the article tag.

.post-password-required .entry-title {
    color: red;
}

Note - This may vary from theme to theme but should give you a good idea of how to do it.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745264020a4619341.html

相关推荐

  • wp admin - Change the color of the Password Protected Post titles

    I want to change the color of the protected post titles. When a post is in protected status (have password), the post ti

    4小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信