Created
October 25, 2011 17:28
-
-
Save vc27/1313579 to your computer and use it in GitHub Desktop.
Add a post_type class to the admin body element. Helpful when styling custom post types.
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
/** | |
* Filter Admin body class | |
* | |
* Add a post_type class to the admin body element. Helpful when styling custom post types. | |
**/ | |
add_filter( 'admin_body_class', 'vc_admin_body_class' ); | |
function vc_admin_body_class( $admin_body_class ) { | |
global $post; | |
if ( $_GET['post_type'] ) | |
$post_type = $_GET['post_type']; | |
elseif ( $post->post_type ) | |
$post_type = $post->post_type; | |
if ( $post_type ) | |
$admin_body_class = "$admin_body_class post_type-$post_type"; | |
return $admin_body_class; | |
} // end function vc_admin_body_class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment