/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if ( is_page() && $post->post_parent ) { $id = get_the_ID(); $a = get_ancestors( $id, 'page' ); $rootId = $a[$root]; } else { $rootId = get_the_ID(); } ?> <body <?php body_class(); ?> id="root-id-<?php echo $rootId ?>">
Comments
