0

I want to create static block in Magento 2.3.5 and call that block in footer content. please anyone can have idea then please share with me.

Thank you in Advance.

2 Answers 2

2

If you want to call static block in the phtml file then please add below code.

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

If you want to add it in the CMS page then please add below code.

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

And if you want to add through XML then please add below code.

<referenceContainer name="content"> 
    <block class="Magento\Cms\Block\Block" name="YOUR_BLOCK_ID"> 
        <arguments> 
            <argument name="block_id" xsi:type="string">YOUR_BLOCK_ID</argument> 
        </arguments> 
    </block> 
</referenceContainer>

Happy Coding.

1

You can add in footer_links block

<referenceBlock name="footer_links">
      <block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="catalog/seo/search_terms" name="search-term-popular-link">
         <arguments>
            <argument name="label" translate="true" xsi:type="string">Search Terms</argument>
            <argument name="path" xsi:type="string">search/term/popular</argument>
         </arguments>
      </block>
   </referenceBlock>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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