3

I have created widget

Type: CMS Static Block
Theme: My Theme
Display on: All Pages
Container: CMS Footer Links
Template: CMS Static Block Default Template
Widget Options: Block (My selected block)

It display my block content on Footer.

Above settings work fine in default Magento 2.1.4 CE, but it's not working on my Porto Theme.

So how to manually call my Widget in my Theme i think Theme's default.xml or in .phtml file or in My Custom Module?

0

You can created the Widget in Block in admin panel and use in the .phtml file using below code:

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

If you have a block called header_tel then inside of a .phtml file, you can programatically display the block using this:

<?php
    echo $block->getLayout()
          ->createBlock('Magento\Cms\Block\Block') // Static block
          ->setBlockId('header_tel') // id of block
          ->toHtml(); // render block
?>

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.