1

I created a CMS static block called social_media_block through the admin site then created a widget with that block and place it in the page footer. It shows up as the last block in the footer and I would like it to be placed after the newsletter block and before the footer links. I tried the to move the block with

<move element="social_media_block" destination="footer" after="form.subscribe"/>

in app/design/frontend/my/theme/Magento_Theme/layout/default.xml but not moving. Can CMS static block widgets be moved or do I need to create it another way?

Edit: I tried adding this but got an Invalid block type: Magento\Cms\Block\Widget\Block Exception

<block class="Magento\Cms\Block\Widget\Block " name="social_media_block" before="footer_links"/>
0

Try this. I'm also not sure you need need to create a widget with that block. Although, I've personally never created a widget. You would need to put the block code within the <referenceContainer name="footer-container">

<block class="Magento\Cms\Block\Block" name="social_media_block" before="footer_links">
  <arguments>
     <argument name="block_id" xsi:type="string">social_media_block</argument>
  </arguments>
</block>

From how I understand it, since that block is something you created and not exactly an out of the box block that comes with Magento, you can't move it. That's just how I interpret it from my understanding.

And the arguments are necessary, else the system won't know what static block to pull.

Also, you can always echo the static block you created in a .phtml file like so:

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

Good for if want to customize the layout of the footer.phtml file or something.

  • Thank you very much. Worked like a charm. No need to create the widget. – D. Hobaugh Oct 18 '16 at 19:27
  • Awesome! Can you mark my answer as the correct answer when you get a chance? Thanks! – Amy Ling Oct 20 '16 at 15:32

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.