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 01 Answer
Reset to default 1To 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
评论列表(0条)