0

How can I add a static block to the top header in Luma theme (see screenprint) ?

enter image description here

2 Answers 2

2

app/design/frontend/[Package]/[Theme]/Magento_Theme/layout/default.xml

 <referenceContainer name="header.panel">
    <block class="Magento\Cms\Block\Block" name="header.promotion.message">
        <arguments>
            <argument name="block_id" xsi:type="string">header_promotion_message</argument>
        </arguments>
    </block>
</referenceContainer>

<move element="header.promotion.message" destination="header.panel" before="-"/>

Note: header_promotion_message is your Block Id

enter image description here

Hope this will help you. thanks

1
  • Thanks, perfect solution Commented Oct 10, 2019 at 11:49
0

Add below code at after top.search referenceContainer:

app/code/design/frontend/[Package]/[Theme]/Magento_Search/layout/default.xml

    <referenceContainer name="header-wrapper">
        <block class="Magento\Cms\Block\Block" name="Promo">
            <arguments>
                <argument name="block_id" xsi:type="string">topPromo</argument>
            </arguments>
        </block>
    </referenceContainer>

Note: Need to change block id topPromo with your block Id and need some CSS for positioning.

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.