Fri. Apr 25th, 2025

19. Magento. How to add a new static block to the header/footer section

1 min read
  1. Log into your Magento Admin panel and navigate to CMS -> Static Blocks

    .

  2. Click on Add New Block button:
    magento_how_to_add_a_new_static_block_to_the_Header_Section_1
  3. Specify your Block Title and Block Identifier.
  4. Remember or copy your Identifier.
  5. Select the store view for which you want to add this Static block and alter the Content Field:
    magento_how_to_add_a_new_static_block_to_the_Header_Section_2
  6. Using your FTP client or any FileManager, navigate to app\design\frontend\default\themeXXX\template\page\html folder.
  7. Open header.phtml file using any text editor.
  8. Depending on where exactly you wish to place your Static Block, paste the following code:
    1
    <?php echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘custom_block_id’)->toHtml() ?>

    where custom_block_id is your identifier which you’ve indicated when creating the Static Block:

    magento_how_to_add_a_new_static_block_to_the_Header_Section_3

  9. Save this file and upload to the server.
  10. Reload your site to see the changes.

Thank you for reading this tutorial. Now you know how to add a static block to the header section in Magento.

April 2025
M T W T F S S
« Jun    
 123456
78910111213
14151617181920
21222324252627
282930