Body Class for Pages Built With Elementor
Adds a "wpide-elementor-page" class to the body of pages built with Elementor, so your theme CSS can treat designed pages differently from regular posts.
Opens WPIDE on
Code
add_filter( 'body_class', function ( $classes ) {
if ( is_singular() && 'builder' === get_post_meta( get_queried_object_id(), '_elementor_edit_mode', true ) ) {
$classes[] = 'wpide-elementor-page';
}
return $classes;
} );
Notes
Use it in CSS, for example .wpide-elementor-page .site-content { padding: 0; }.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.