Skip to content

Instantly share code, notes, and snippets.

View Dawqss's full-sized avatar

Dawid Wyrkowski Dawqss

View GitHub Profile
@Dawqss
Dawqss / magento2-include-static-blocks.md
Created June 13, 2018 12:40 — forked from mttjohnson/magento2-include-static-blocks.md
Magento 2 - Include Static Blocks (template/cms/layout)

In .phtml tempalte file:

<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?>

In CMS content:

{{block class="Magento\\Cms\\Block\\Block" block_id="block_identifier"}}

In layout .xml file:

<referenceContainer name="content">
  <block class="Magento\Cms\Block\Block" name="block_identifier">