How to add new blocks to a page in magento

First of all, write the code in the respective phtml file and then copy the content to the backend by creating a block in

CONTENT-> BLOCK -> NEW BLOCK

then call the block in the respective HTML file using the following code

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

Leave a comment

Your email address will not be published. Required fields are marked *