i have a custom post type called 'auctions', and i'd like to be able to visually differentiate auctions from posts and pages in the backend by assigning a different background color to the auction post type.

this could be easily achieved if i had a way to assign a body class to admin pages pertaining to this specific post type, except i'm not sure as to how i'd go about that :).

any help would be greatly appreciated. thanks!

1 Answer 1


Easy and your css to overwrite the default style like this

add_action('admin_print_styles', 'auctions_admin_print_styles_332');

function auctions_admin_print_styles_332(){
   if ((isset($_GET['post_type']) && $_GET['post_type'] == 'auctions') || (isset($post_type) && $post_type == 'auctions')){

     //include your css file using wp_enqueue_style() somthing like 
      wp_enqueue_style( 'handle name', plugins_url('/style.css', __FILE__), array(), '1.0' );

      // or a more hackish way would be to echo out the css style tag

so the class you are looking for is actualy an id "wpwrap" so you can use something like this:

<style type="text/css">
#wpwrap{background-color: #FFF;}

Hope this helps


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.