1

i want create a custom block inside the header wrapper. I have put the code inside the default.xml from my child theme and have created a .phtml file with a h1 for test, but it's not working.

The .phtml file is in: /Magento_Theme/templates/html/header/header-links.phtml

My Code in the default.xml:

<referenceContainer name="header-wrapper">
        <container name="header-links-test" htmlClass="container_css_class" htmlTag="div" after="top.search">
            <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::templates/html/header/header-links.phtml" name="block_name" />
        </container>
</referenceContainer>

1 Answer 1

1

Please correct your code by removing "templates" word from your template path.

<referenceContainer name="header-wrapper">
        <container name="header-links-test" htmlClass="container_css_class" htmlTag="div" after="top.search">
            <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html/header/header-links.phtml" name="block_name" />
        </container>
</referenceContainer> 
1
  • please vote my answer and mark it resolved. Commented Mar 13, 2017 at 14:50

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.