Skip to content

Instantly share code, notes, and snippets.

@secretstache
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secretstache/cf7179963cd231ba8488 to your computer and use it in GitHub Desktop.
Save secretstache/cf7179963cd231ba8488 to your computer and use it in GitHub Desktop.
Adds a unique body class to the editor screen of a specific page, in this case the home page
add_filter( 'admin_body_class', 'ssm_home_admin_body_class' );
/*
* Adds a body class to target the home page edit screen
*
*/
function ssm_home_admin_body_class( $classes ) {
global $post;
$screen = get_current_screen();
$homepage = get_page_by_title( 'Home' );
if ( 'post' == $screen->base && ( $post->ID == $homepage->ID ) ) {
$classes .= 'front-page';
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment