How can I add a static block to the top header in Luma theme (see screenprint) ?
2 Answers
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
Hope this will help you. thanks
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.