Last active
August 29, 2015 14:13
-
-
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
This file contains hidden or 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
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