2

How is this possible? I know how to do it with two different blocks but I don't know how to reorder a CMS block with a a module block.

enter image description here

2

1 Answer 1

2

To rearrange elements you need to use the <move> tag.

Here's the official documentation about it: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html#layout_markup_rearrange

In your case I reckon the right code would be something that looks like this:

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="your.static.block.name" destination="page.top" before="breadcrumbs"/>
    </body>
</page>

Don't forget to change the element attribute value with the value of your block name.

5
  • I thought it could be something like that. Thank you very much Raphael. May 24, 2016 at 12:32
  • Is it okay to use "move" for all of my static blocks in the default layout xml file for my theme? Am I okay to move them if they don't appear on that page or will that throw an error? May 24, 2016 at 12:36
  • @user3621758 yes I reckon you can. You need to try though May 24, 2016 at 13:27
  • I did try, it didn't really do anything. Unless I have the container names wrong. May 24, 2016 at 13:36
  • 1
    @user3621758 You can check if the container name is correct by removing it. If it doesn't remove itself then you have the name wrong - <referenceContainer="name.here" remove="true" />
    – Ben Crook
    May 25, 2016 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.