Magento2 Move static block to above footer and below main content
-
16-03-2021 - |
Pergunta
In my magento2 based website I have a static block that i want to load right before the footer block but below the main content of the page. I have tried the below but that did not seem to make it load anywhere. I also tried replacing the name value in the referenceContainer to footer but then that put the static block inside the footer which is not what I want because I want/need this static block to be full width of the page and not contained within any other div.
thoughts on how to achieve this?
<referenceContainer name="page.main">
<block class="Magento\Cms\Block\Block" name="muah_landingpg_footer_banner" after="-">
<arguments>
<argument name="block_id" xsi:type="string">muah_landingpg_footer_banner</argument>
</arguments>
</block>
Solução
Can you please try this ?
<referenceContainer name="page.wrapper">
<block class="Magento\Cms\Block\Block" name="muah_landingpg_footer_banner" before="page.bottom">
<arguments>
<argument name="block_id" xsi:type="string">muah_landingpg_footer_banner</argument>
</arguments>
</block>
</referenceContainer>
Outras dicas
Try with container page.bottom
. Take a look at vendor/magento/module-theme/view/frontend/layout/default.xml
to see more details.
For example:
<referenceContainer name="page.bottom">
<block class="Magento\Framework\View\Element\Template" name="test.data" template="Vendor_PageLayout::test.phtml"/>
</referenceContainer>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange