1

i would like to add a static block between the nav menu en the content so i can give it the full width of the page. This block must only be visible for the contact us page.

System: magento 2.1

Theme: destino

File path: /app/design/frontend/Sm/destino/Magento_Contact/layout/contact_index_index.xml

content of contact_index_index.xml:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="page.wrapper">
    <container name="contact.custom.block" before="main.content">
        <block class="Magento\Cms\Block\Block" name="contact-maps" after="breadcrumbs">
            <arguments>
                <argument name="block_id" xsi:type="string">contact-maps</argument>
            </arguments>
        </block>
    </container>
</referenceContainer>
</body>

See image below:

enter image description here

Thanks

3 Answers 3

1

Try this /app/design/[Vendor]/[theme]/Magento_Contact/layout/contact_index_index.xml file and paste this.

 <referenceContainer name="page.wrapper">
    <container name="contact.custom.block" before="main.content">
        <block class="Magento\Cms\Block\Block" name="cms-block-identifier">
            <arguments>
                <argument name="block_id" xsi:type="string">home_banner_top</argument>
            </arguments>
        </block>
    </container>
</referenceContainer>
0

create /app/design/[Vendor]/[theme]/Magento_Contact/layout/contact_index_index.xml file and paste this.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
    <referenceContainer name="page.wrapper">
        <container name="contact.custom.block" after="breadcrumbs">
            <block class="Magento\Cms\Block\Block" name="cms-block-identifier">
                <arguments>
                    <argument name="block_id" xsi:type="string">cms-block-identifier</argument>
                </arguments>
            </block>
        </container>
    </referenceContainer>
    </body>
</page>
11
  • OP asked before text not before the contact form.
    – vaso123
    Commented Mar 30, 2018 at 8:41
  • The text is added in form.phtml itself. Commented Mar 30, 2018 at 8:51
  • i tried your solutions and it works, but i can't set the width of the block to full width because it is know inside the form 'wrapper'
    – naknak12
    Commented Mar 30, 2018 at 9:09
  • @naknak12 see my updated answer. Commented Mar 30, 2018 at 9:52
  • i changed the 'cms-block-identifier' to contact-maps as that is the name of my block. But nothing appears. I also modified the original file but then also nothing changes on the page. (i cleared the cache)
    – naknak12
    Commented Mar 30, 2018 at 10:06
0

Try this /app/design/[Vendor]/[theme]/Magento_Contact/layout/contact_index_index.xml file and add this code.

<referenceContainer name="page.wrapper">
    <container name="contact.map.block" htmlTag="div" htmlClass="contact-map" after="main.content">
        <block class="Magento\Cms\Block\Block" name="contact-map">
            <arguments>
                <argument name="block_id" xsi:type="string">contact_map</argument>
            </arguments>
        </block>
    </container>
</referenceContainer>

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.