Question

I am facing issue with creating a block between header.container and main. so that I can put the banner over there. And I need the banner in home page only

please help me for the same.

Was it helpful?

Solution

I have tried and its working for me.

<referenceContainer name="page.wrapper">
        <container name="page.wrapper.second" as="page_wrapper_second" htmlTag="div" htmlClass="my-custom-div" before="main.content">
               <block class="Magento\Cms\Block\Block" name="your_banner_block">
                     <arguments>
                          <argument name="block_id" xsi:type="string">your_banner_block</argument>
                     </arguments>
               </block>
        </container>
</referenceContainer>

You have to place your banner block instead of "your_banner_block" block.

OTHER TIPS

You can use Widget

  • On the Admin Panel
    Content > Elements > Widgets
  • In the upper-right corner of Widgets workplace, click on Add New Widget button.
  • In the Settings section:
    • Choose CMS Static Block type in the Type box.
    • Choose the current theme you are applying in the Design Theme.
    • Click Continue button.

enter image description here

Complete the Layout Updates enter image description here

I have found the answer ...that we should create the custom xml file for that ..and assign the custom xml to the home page from admin side..mention in the custom xml whatever we want and positions..then it will come

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top