How to Change Background Color of Posts in WordPress

How to Change Background Color of Posts in WordPress

Spread The Love

If want to change background color of Posts in WordPress then this article is for you.

In WordPress admin, all Posts Page includes different types of posts Drafts, Published, Future, Pending, Private Password Protected, Other’s Author etc.



Change the Background color f Posts on the Basis of its Current Status
Change the Background color of Posts on the Basis of its Current Status

In this article we are going to discuss how to add different background color to the posts in WordPress admin based on their current status. This helps you to identify The WordPress admin Posts on the basis of its current status.

You can use this Hook:

add_action('admin_footer', 'wordpress_admin_posts_background');
function wordpress_admin_posts_background() {
    $wordpress_post_pages_colors = get_tweaks_dashboard_data("dashboard_settings");
    ?>
    <style>
        .status-publish{background: #000000 !important;}
        .status-draft{background: <?php echo $wordpress_post_pages_colors["draft_color"]; ?> !important;}
        .status-pending{background: <?php echo $wordpress_post_pages_colors["pending_color"]; ?> !important;}
        .status-future{background:  <?php echo $wordpress_post_pages_colors["future_color"]; ?> !important;}
        .post-password-required{background:  <?php echo $wordpress_post_pages_colors["password_protected_color"]; ?> !important;}
        .status-private{background:<?php echo $wordpress_post_pages_colors["private_color"]; ?>!important;}
        .author-other{background:<?php echo $wordpress_post_pages_colors["other_authors_color"]; ?>!important;} // for non admin Users
        .status-sticky {background: #000000 !important;}
    </style>
    <?php
}
add_action('admin_footer', 'wordpress_admin_posts_background');

If you want to know how to create a Post in WordPress you can visit WordPress Posts

If You liked my Article, Then Please Like my Facebook Page for latest WordPress Tutorials and Latest Updates. You can also subscribe my Newsletter for latest updates.

  • 23
    Shares

Himani Bhardwaj

I Himani Bhardwaj founder of Plugins Reviews and also a Professional Developer. I'm a Passionate self-made Girl and plays an active role in the activities of WordPress Plugin Reviews I have also attended Chandigarh WordPress Meetup Sessions. I run an online website geared to help those who wants to Know about WordPress Topmost Plugins, Themes and also who wants to learn about PHP Concepts

This Post Has 2 Comments

  1. Very nice article, just what I needed.

Leave a Reply

Close Menu