Skip to content

Instantly share code, notes, and snippets.

@kfriend
Created March 25, 2013 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kfriend/5240927 to your computer and use it in GitHub Desktop.
Save kfriend/5240927 to your computer and use it in GitHub Desktop.
Add post-type-derived class to Wordpress's admin <body>
<?php
// functions.php
add_filter('admin_body_class', function($classes) {
global $wpdb, $post;
if (is_admin())
{
$post_type = get_post_type($post->ID);
return $classes .= ' admin-type-'.$post_type;
}
return $classes;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment