I'm creating a magento 2 theme. I want to display the custom blocks on the cms homepage.
I want to know to show the static blocks in phtml and xml layout, cms page contents
How can I do?
Please try to use below codes.
In Phtml File:
<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?>
in CMS Content:
{{block class="Magento\\Cms\\Block\\Block" block_id="block_identifier"}}
In Xml File:
<referenceContainer name="content">
<block class="Magento\Cms\Block\Block" name="block_identifier">
<arguments>
<argument name="block_id" xsi:type="string">block_identifier</argument>
</arguments>
</block>
</referenceContainer>