Created
August 14, 2012 21:05
-
-
Save georgestephanis/3353037 to your computer and use it in GitHub Desktop.
For Greg
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
| </head> | |
| <?php | |
| $class = ''; | |
| if( is_page() ) { | |
| global $post; | |
| /* Get an array of Ancestors and Parents if they exist */ | |
| $parents = get_post_ancestors( $post->ID ); | |
| /* Get the top Level page->ID count base 1, array base 0 so -1 */ | |
| $id = ( $parents ) ? array_pop( $parents ) : $post->ID; | |
| $class = 'descended-from-page-' . $id; | |
| } | |
| ?> | |
| <body <?php body_class( $class ); ?>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment