I created a static block in backend of my magento and now i would like to recall the created block in the footer, near to the footer link .

In what phtml files I retrieve it?


P.S. Where is the file of footer links for change the link and name?


2 Answers 2


From templates you can simply call static block by
<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?>
Links in footer generate by layout in module Magento_Theme

<referenceContainer name="footer-container">
        <container name="footer" as="footer" label="Page Footer" htmlTag="div" htmlClass="footer content">
            <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" template="switch/stores.phtml"/>
            <block class="Magento\Framework\View\Element\Html\Links" name="footer_links">
                    <argument name="css_class" xsi:type="string">footer links</argument>
            <block class="Magento\Theme\Block\Html\Footer" name="copyright" template="html/copyright.phtml"/>
            <block class="Magento\Framework\View\Element\Template" name="report.bugs" template="Magento_Theme::html/bugreport.phtml" />
  • Thanks man, i tried this but what is the file of the footer where i can call my static block? I try to paste this code in html/footer.phtml in Magento_Theme but not function...why?
    – Gabriel91
    Commented Feb 9, 2016 at 16:18
  • You should enable path hint from backend to find right files to modify. Basiclly theme merchanism fallback will find required files in your current active theme, if it fail it will try to find from parent theme if fail it will find in core modules
    – mrtuvn
    Commented Feb 11, 2016 at 5:36

Or from any code location with the block id:-

class MyBlock
     * @var \Magento\Cms\Model\Template\FilterProvider
    protected $_filterProvider;

     * Store manager
     * @var \Magento\Store\Model\StoreManagerInterface
    protected $_storeManager;

     * Block factory
     * @var \Magento\Cms\Model\Block
    protected $_block;

     * @param Magento\Framework\View\Element\Template\Context $context
     * @param Magento\Store\Model\StoreManagerInterface $storeManager,
     * @param Magento\Cms\Model\Template\FilterProvider $filterProvider,
     * @param Magento\Cms\Model\BlockFactory $blockFactory,
     * @param array $data
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        \Magento\Cms\Model\Template\FilterProvider $filterProvider,
        \Magento\Cms\Model\BlockFactory $blockFactory,
        array $data = []
    ) {
        $this->_storeManager = $storeManager;
        $this->_filterProvider = $filterProvider;
        $this->_block = $blockFactory->create()->setStoreId(
        parent::__construct($context, $data);

     * @return string
    protected function getHtml() {
        $html = '';
                $html = $this->_filterProvider->getBlockFilter()->setStoreId(
        return $html;

Your Answer

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

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