0

I am new to magento 2.I want to use custom header and footer design for my site but don't where to keep that code. I am using blank theme. Please help me. Thanks in advance.

0

Add custom header:

/app/design/frontend/{vendor}/{theme}/Magento_Theme/layout/default.xml

<referenceContainer name="page.wrapper">
    <block class="Magento\Framework\View\Element\Template" name="custom_header" template="Magento_Theme::html/header.phtml" before="main.content">
    </block>
</referenceContainer>

Add the header template to:

/app/design/frontend/{vendor}/{theme}/Magento_Theme/templates/html/header.phtml

Add custom footer:

/app/design/frontend/{vendor}/{theme}/Magento_Theme/layout/default.xml

<referenceContainer name="footer-container">
    <block class="Magento\Framework\View\Element\Template" name="custom_footer" template="Magento_Theme::html/footer.phtml">
    </block>
</referenceContainer>

Add the footer template to:

/app/design/frontend/{vendor}/{theme}/Magento_Theme/templates/html/footer.phtml

| improve this answer | |

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.