In blog, we will learn how to used CMS block in the front-end. we have listed some methods for displayed CMS block on the front-end.
Method 1: call CMS static block in phtml file in Magento 2
<?php
echo $this->getLayout()
->createBlock('Magento\Cms\Block\Block')
->setBlockId('cms_block_identifier')
->toHtml();
?>
Method 2: call CMS static block in CMS page in Magento 2
{{block class="Magento\Cms\Block\Block" block_id="cms_block_identifier"}}
Method 3: call CMS static block in xml file in Magento 2
<referenceContainer name="content">
<block class="Magento\Cms\Block\Block" name="cms_block_name">
<arguments>
<argument name="block_id" xsi:type="string">cms_block_identifier</argument>
</arguments>
</block>
</referenceContainer>
We hope this blog is helpful for you. Please leave comment if you have any question. Thank you!