Add ‘div’ before all the elements in the page in Elementor

You can add a <div> element before all the elements in a page created with Elementor by using the elementor/frontend/widget/before_render action hook.

Here’s an example of how you can use this hook to add a <div> element before all the elements in a page:

function my_custom_before_render( $widget ) {
    echo '<div class="my-custom-class">';
}
add_action( 'elementor/frontend/widget/before_render', 'my_custom_before_render' );

This will add a <div> element with the class “my-custom-class” before all the elements in the page.

It is important to note that this will affect all widgets globally across the pages/posts that use Elementor, and you may need to use css selectors in your css styles to target specific elements.

You can also use a do_action hook on the elementor/frontend/after_render to close the div

function my_custom_after_render( $widget ) {
    echo '</div>';
}
add_action( 'elementor/frontend/after_render', 'my_custom_after_render' );

It is also important to consider that this can also have an impact in performance and could cause issues with the HTML structure, please make sure to properly test it in all your pages.