2

I want to remove header & footer from login page.

I tried following code.but its not working. Can you anyone help me on this?

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="root">
        <referenceContainer name="head" remove="true"/>
        <referenceContainer name="header" remove="true"/>
        <referenceContainer name="menu" remove="true"/>
        <referenceContainer name="notifications" remove="true"/>
        <referenceContainer name="footer" remove="true"/>
        </referenceContainer>
    </body>

3

Where did you add that code? Also the root reference is not required.

I created entered the below code into app/design/frontend/**VENDOR**/**THEME**/Magento_Customer/layout/customer_account_login.xml and it worked, you may need to change header.container to a different block depending how much of the header you want to remove. This will remove ALL the header leaving only the nav and the login/register content.

<?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>
        <referenceContainer name="header.container" remove="true" />
        <referenceContainer name="footer" remove="true" />
    </body>
</page>

enter image description here

  • You can find most the layout block/container named in vendor/magento/module-theme/view/frontend/layout/default.xml – Ben Crook May 12 '16 at 12:00
  • can you be specific regarding this path? thanks! – Ree Oct 19 '16 at 7:03
  • Do you mean where I've entered VENDOR**/**THEME? If so this is just the name of your store and the theme – Ben Crook Oct 19 '16 at 8:37
  • I meant vendor/magento/module-theme/view/frontend/layout/default.xml I couldnt find where is magento/module-theme – Ree Oct 20 '16 at 3:30
  • That is the full path, if you have installed Magento via Composer you should have a vendor directory which contains all the code. If you have installed via another method the same code may be in app/design/frontend/Magento/Theme/view/frontend/layout/default.xml but I've never seen it done this way. – Ben Crook Oct 20 '16 at 9:47
2

For magento 2.2.4, use ,footer-container as footer container.

use below code:

    <referenceContainer name="header.container" remove="true"/>
    <referenceBlock name="catalog.topnav" remove="true"/>
    <referenceContainer name="footer-container" remove="true"/>
1

Try with following code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="head" remove="true"/>
    <referenceContainer name="header" remove="true"/>
    <referenceContainer name="menu" remove="true"/>
    <referenceContainer name="notifications" remove="true"/>
    <referenceContainer name="footer" remove="true"/>
</body>
0

Try using below code:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="block_name" remove="true"/>
    </body>
</page>

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.