문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top