Last active
October 8, 2015 17:08
-
-
Save aliciaduffy/3362654 to your computer and use it in GitHub Desktop.
WordPress / ADMIN / Add post type to admin body class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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