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.

1 Answer 1

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

1
  • How to add CSS for the header and footer?
    – zus
    Dec 1, 2020 at 6:41

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.