How to Add Static Block to your theme – Magento

Create an Static Block from your CMS admin tab and show it in your theme.

In my case I wanted to call a Static Block from my theme to show up in the sidebar.

I edited my theme file called 2columns-left.phtml and then added the following code.

Please notice you need to replace the YourBlockId with your own Static Block Id.

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('YourBlockId')->toHtml() ?>	Code language: HTML, XML (xml)

Comments

  1. Will says:

    Cant get translations to work with this method

  2. Nicole says:

    I have found it already, thanks!

    1. quicoto says:

      Great.

      I was going to say: A Static Block can not be surfed like a Page. So there is no address 😛

      Regards 😉

  3. Nicole says:

    Quicoto

    a simple question – when you create a Block ID, is it the http address where the system finds the block -photo?

    Nicole

Leave a Reply

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