How to call static block in front end of site? Exact steps to display it by taking example of identifier: 'footer-link'
How can I do it?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityyou can call it like this.
{{block type="cms/block" block_id="footer-link"}}
in cms -> homepage-> content
You can reference static blocks within xml for pages like product pages:
<referenceBlock name="product.info.main">
<block class="Magento\Cms\Block\Block" name="product.staticblock" as="staticblock" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Footer Links</argument>
<argument name="block_id" xsi:type="string">footer-link</argument>
</arguments>
</block>
</referenceBlock>
Various blocks can be referenced depending on where you want your block to display.
Above XML should go in your theme within:
'Magento_Catalog/layout/catalog_product_view.xml'
Or when within a module:
'view/frontend/layout/catalog_product_view.xml'
The below can reference a static block within phtml file within template:
echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('footer-links')->toHtml();
As suggested by Nikunj Vadariya to include static block from CMS use:
{{block type="cms/block" block_id="footer-link"}}