Home › Forums › Support › Add body class when post comments are active This topic has 3 replies, 2 voices, and was last updated 3 years, 5 months ago by David. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts November 8, 2020 at 7:03 am #1522623 George I want to modify the layout depended on whether the bottom comment box in a post is active or not. Is there a way to add a body class when the comment form is active? November 8, 2020 at 7:56 am #1522701 DavidStaff Customer Support Hi there, you can try checking if comments are open and appending a new body class: add_filter( 'body_class', function( $classes ) { if ( !comments_open() ) { return $classes; } return array_merge( $classes, array( 'class-name' ) ); } ); November 8, 2020 at 8:20 am #1522737 George This is amazing, David, thank you! November 8, 2020 at 10:16 am #1522844 DavidStaff Customer Support Glad to be of help Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In