1

In Magento 2.* we could extend core layouts using custom theme, for instance, (assuming our custom theme is named Custom/our_theme) if we want to remove header & footer in customer login page we did

app/design/frontend/Custom/our_theme/Magento_Customer/layout/customer_account_login.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="footer" remove="true"/>
        <referenceContainer name="header.container" remove="true"/>
    </body>
</page>

However, in Magento 2.3 that way to extend layouts seem to have no effect. The strange thing is we can load CSS changes, override templates, etc... with no problem, so it is clear custom theme is well registered & it is working

But the only way to change layout structure seem to be doing it in a custom module (using layout_load_before event, for instance)

Is this a common issue? I mean, have you faced this in Magento 2.3 here? Or should we assume there is something wrong in our project?

UPDATE

We've seen that applying changes as layout updates then it does work

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <referenceContainer name="footer" remove="true" />
    <referenceContainer name="header.container" remove="true" />
</layout>

What I don't understand is why the first way (including page & body tags) has stopped working

  • I think you forgot to add <?xml version="1.0"?> see my answer its working fine. – Amit Naraniwal Mar 5 at 5:56
  • That part is present in code, I just didn't paste as it is assumed to be... The only difference I see in your code is the missing of the layout parameter in XML page main tag. I don't know if that could cause the error, but I will try later & give feedback – Raul Sanchez Mar 5 at 6:57
0

I have tried the below code in my custom theme for Magento2.3 and its working fine :

app\design\frontend\Packagename\mytheme\Magento_Customer\layout\customer_account_login.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <body> 
      <referenceBlock name="header.container" remove="true" />  
      <referenceBlock name="footer" remove="true" />
  </body> 
</page> 
  • Sorry I didn't read this... Are you sure that's working? Do you use some 3rd party theme? Both header.container & footer are containers, not blocks, so that referenceBlock shouln'd match anything? – Raul Sanchez May 15 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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