Yep that’s the one – many thanks es!!!
D
Ah thanks esmi.
I pop it at the bottom of functions.php and nothing seems to change until I take the if statement out though. Then it works fine but obviously is on all the pages…
As it’s a image post from a wordpress gallery does that mean I need to call it something else than if( $is_attachment )?
Just to be clear the following does what I required but justs adds the parentis on all the pages not just the image gallery pages.
function my_attachment_body_class($classes) {
global $post;
$classes[] = 'parentis-' . $post->post_parent;
return $classes;
}
add_filter('body_class', 'my_attachment_body_class');