I’m trying to have the post background colors change depending on a meta value for the specific post type rather than using the post status. Looked everywhere and can’t find a solution. (perhaps there isn’t one?)
Specifying post colors based on post-status is simple enough
add_action('admin_footer','posts_status_color');
function posts_status_color(){
?>
<style>
.status-draft{background: #FFFF98 !important;}
.status-pending{background: #FFFF98 !important;}
.post-*id here*{background: #FFFF98 !important;}
.status-publish{/* no background keep wp alternating colors */}
</style>
<?php
}
How do I specify the colors based on a custom meta key/value from the post?
If your theme uses wp post class
then in your style.css you could use:
hence applying that class to all of the posts that contain your desired meta value.
if your theme doesn’t use wp post class you have to edit the theme to include
ex:
all explained here.