1

I created the modified default.xml and created headerContent.phtml to add new content to the header panel to be position on the opposite side of the login and welcome msg. However, after uploading, modifying and clearing all caches, my new content isn't showing up on the page at all.

Vendor/Theme_name/Magento_Theme/layout/default.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>
        <referenceContainer name="header.panel">
            <block class="Magento\Framework\View\Element\Template" name="header.content" template="Magento_Theme::headerContent.phtml" before="header.links" />
        </referenceContainer>    
    </body>
</page>

Vendor/Theme_name/Magento_Theme/templates/headerContent.phtml

Hello World!

What am i doing wrong? did i use the wrong location or a typo somewhere?

1
  • modified to change /templates/html/ to /templates/ - mistyped the folder directory
    – Blitzo
    Commented Aug 21, 2017 at 11:21

1 Answer 1

0

You have missed out html in the template path.

So change

template="Magento_Theme::headerContent.phtml"

To

template="Magento_Theme::html/headerContent.phtml"
6
  • thank you for your reply. i will adjust its just in templates not templates/html. my mistake. any other errors other than that? it didnt work for me.
    – Blitzo
    Commented Aug 21, 2017 at 11:17
  • Not that I can see, have you cleared caches?
    – Ben Crook
    Commented Aug 21, 2017 at 12:20
  • I don't think it matters but Magento don't use camel case for template names, you could try changing headerContent to header_content and see if that makes a difference. Again clear Magento cache after making that change
    – Ben Crook
    Commented Aug 21, 2017 at 12:25
  • thanks. I changed it to header_content. definitely flushed and cleared caches. still a no go. not sure why. not responding at all.
    – Blitzo
    Commented Aug 22, 2017 at 8:23
  • do i have to redeploy the theme for it to take effect? thats the only thing i didnt do.
    – Blitzo
    Commented Aug 23, 2017 at 6:44

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.