I'm creating a new theme for a Magento 2.2.6 community edition and I need to wrap all the content inside a CSS class. To do so I had to change

<main id="maincontent" class="page-main">


<main id="maincontent" class="page-main myCustomWrapper">

To do that. I understand I need to change the line

<container name="main.content" htmlTag="main" htmlId="maincontent" htmlClass="page-main">

in the in the empty.xml file to

<container name="main.content" htmlTag="main" htmlId="maincontent" htmlClass="page-main myCustomWrapper">

I've tested that in the vendor/magento/module-theme/view/base/page_layout/empty.xml file and it worked. I then reverted and tried copying it to my theme. I followed the instructions here: Override base empty.xml file to rename the page-wrapper class and tried all possible combinations I could think about. Here the list of the files I tried:

  • Magento_Theme/view/layout/override/base/empty.xml
  • Magento_Theme/view/layout/base/empty.xml
  • Magento_Theme/view/frontend/layout/page_layout/empty.xml
  • Magento_Theme/view/frontend/page_layout/empty.xml
  • Magento_Theme/view/base/page_layout/empty.xml
  • Magento_Theme/page_layout/empty.xml

They all inside my frontend theme, but none of the tested files worked.

Is my frontend theme working?

Yes. That was the first thing I tried. I changed it int the backend/admin, I changed the Magento_Theme/templates/html/header/logo.phtml and changes were shown in my site, so the theme does work.

Did I clean cache?

Yes, before refreshing the page, I did clean the cache and remove all files in pub/static/* var/view_preprocessed/ var/di/* var/generation/* after every change in all the possible */empty.xml.

I asked in the freenode channel, I looked in the magento stackexchange site, but nothing.

Any hints will really be appreciated.

1 Answer 1


You can override "empty.xml" in a custom module. Just put it in app/code/<Vendor>/<module>/view/base/page_layout/empty.xml

  • 2.3 = /app/design/frontend/<vendor>/<module>/Magento_Theme/page_layout/empty.xml
    – zigojacko
    Commented Apr 16, 2020 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.