0

This is my first theming product using Magento 2. I have themed Magento 1.9 previously (twice).

I have tried to move elements or remove blocks in the default.xml file but nothing seems to be working.

I created a child theme off of Luma and it has been set to that child theme in configurations.

File I'm using to move and remove blocks is /my-theme/Magento_Theme/layout/default.xml

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Poppins:500,600">
</head>
<body>
    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_file" xsi:type="string">images/logo.svg</argument>
            <argument name="logo_alt" xsi:type="string">The Platform</argument>
            <argument name="logo_img_width" xsi:type="number">200</argument>
            <argument name="logo_img_height" xsi:type="number">35</argument>
        </arguments>
    </referenceBlock>

    <referenceBlock name="form.subscribe" remove="true" />
</body>
</page>

I have cleared all cache, remove static files, ran the command line php bin/magento setup:upgrade but still nothing.

Do I need to do anything different if I'm doing this on localhost? I'm also using MAMP if that makes any difference.

Any help will be greatly appreciated.

  • Can you please post the code you wrote to move/remove blocks? – Sejal Shah Oct 4 '18 at 18:14
  • update your question with the default.xml code also have you configured theme as well ( in admin under Content->Design->Configuration) ? – Naveed Asim Oct 4 '18 at 18:14
  • @NaveedAsim I have updated my question. – Amy Ling Oct 4 '18 at 19:10
  • @SejalShah I have updated my question. – Amy Ling Oct 4 '18 at 19:11
0

So, the reason my default.xml was not working is because my theme folder was named /luma_child/.

Once I renamed it to /lumachild/ and cleared cache, everything was working.

0

if you want to remove newsletter from footer, Create this file in your own theme or add to it.

app/design/frontend/YourCompany/your_theme/Magento_Theme/layout/default.xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="form.subscribe" remove="true" />
    </body>
</page>

This will remove the footer subscribe form from every page of your site.

after create and add above code into your file need to run below command

php bin/magento cache:clean && php bin/magento cache:flush -f

  • Hello, I have the same code as above minus the fact that no page layout was selected (I just copied directly from luma and assumed it's for all pages). Do you think that's what makes the difference of things not be removed or moved? – Amy Ling Oct 4 '18 at 18:59
  • Why need to run setup upgrade and static content deploy? – Sukumar Gorai Oct 4 '18 at 20:33

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.