Swap home page based on user role, Elementor layout breaking

I work for a manufacturer that has normal boring consumers and wholesale dealers. We want to display a different home page for these two different audiences. Consumers will get more of a brand overview, while dealers will see current promotions available only to them.

Dealers will have to log in to see this, and I have already created a role for them called “Wholesale.” I have also created two home pages: one for consumers (which is set in WordPress to be the front page) and the one for dealers. The dealer page is a copy and paste of the consumer page, which was built with Elementor.

I have come up with a function (in the theme’s function.php file) that does exactly what I want, except for one flaw: the layout of the dealer home page content is broken.

Here’s the code: