How to Call Static Block in Cms Page Magento 2

  1.  How to Call Static Block In Phtml


Method to call CMS static block in phtml

<?php

echo $this->getLayout()

->createBlock('Magento\Cms\Block\Block')

->setBlockId('your_block_identifier')

->toHtml();

?>


 2.  CMS block in Magento 2 using Layout XML


<referenceContainer name="content">

  <block class="Magento\Cms\Block\Block" name="unick_block_name">

    <arguments>

      <argument name="block_id" xsi:type="string">my_cmsblock_identifier</argument>

    </arguments>

  </block>

</referenceContainer>


3. Block Call in Page


{{block class="Magento\Cms\Block\Block" block_id="home-page-block"}}



ટિપ્પણીઓ

આ બ્લૉગ પરની લોકપ્રિય પોસ્ટ્સ

How to Remove Default Block in Magento 2

Magento 2 Issue Resolved