2

I need to create a link from cms block to the home page to render the contents in storefront.

  • have you tried @Price Solution ? – Pawan Aug 11 '18 at 1:09
0

You have two ways to do that:

  1. via xml

    in : app/design/frontend/{Vendor}/{themename}/Magento_Cms/layout/cms_index_index.xml

    <referenceContainer name="header">
        <block class="Magento\Cms\Block\Block" name="Blockname" after="-">
            <arguments>
                <argument name="block_id_here" xsi:type="string">blockname</argument>
            </arguments>
        </block>
    </referenceContainer>
    
  2. insert the below code in header in your current theme path: app/design/frontend/{Vendor}/{themename}/Magento_Cms/templates/html/header.phtml

    code:

    <?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_id_here')->toHtml();?>
    
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.