Skip to content

Instantly share code, notes, and snippets.

@aliciaduffy
Last active October 8, 2015 17:08
Show Gist options
  • Save aliciaduffy/3362654 to your computer and use it in GitHub Desktop.
Save aliciaduffy/3362654 to your computer and use it in GitHub Desktop.
WordPress / ADMIN / Add post type to admin body class
<?php
function POSTTYPE_to_admin_body_class( $classes ) {
global $post; global $post_type;
$mode = '';
$uri = $_SERVER["REQUEST_URI"];
if (strstr($uri,'edit.php')) {
$mode = ' edit-list-';
}
if (strstr($uri,'post.php')) {
$mode = ' edit-page-';
}
$classes .= $mode . $post_type;
return $classes;
}
add_filter('admin_body_class', 'POSTTYPE_to_admin_body_class');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment