I am trying to move the header to the top of the page.

I'm use in default.xml

<move element="header-bottom" destination="header-top" as="new_alias" before="header-middle"/>

But without a result:

https://zabezcen.pl/

@update

[user@s1 public_html]$ rm -rf pub/static/*
[user@s1 public_html]$ php bin/magento cache:clean
Cleaned cache types:
config
layout
block_html
collections
reflection
db_ddl
eav
customer_notification
config_integration
config_integration_api
full_page
config_webservice
translate
[user@s1 public_html]$

default.xml:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="head.additional">
            <block class="Sm\Market\Block\Template" name="config.theme.setting"
                   template="Magento_Theme::html/config.phtml"/>
        </referenceBlock>
        <referenceContainer name="page.wrapper">
            <container name="header.panel.wrapper" htmlClass="panel wrapper" htmlTag="div" before="-"/>
            <block class="Magento\Theme\Block\Html\Header" name="header.content" template="html/header.phtml"
                   before="page.top">
                <block class="Magento\Newsletter\Block\Subscribe" name="form.subscribe.popup" as="form.subscribe.popup"
                       before="-" template="subscribe-popup.phtml" ifconfig="market/advanced/show_newsletter_popup"/>

                <container name="toplinks-header" label="Header Links" as="toplinks-header" htmlTag="div"
                           htmlClass="toplinks-wrapper"/>

                           <move element="header-bottom" destination="header-top" as="new_alias" before="header-middle"/>

                <container name="navigation-header" label="Navigation" as="navigation-header" htmlTag="div"
                           htmlClass="navigation-wrapper"/>

                <container name="navigation-header-megamenu" label="Megamenu" as="navigation-header-megamenu"
                           htmlTag="div" htmlClass="navigation-megamenu-wrapper">
                    <block class="Sm\MegaMenu\Block\MegaMenu\View" name="megamenu.topnav" as="megamenu_topnav"
                           template="Sm_MegaMenu::megamenu.phtml"/>
                </container>

                <container name="toplinks-header" label="Header Links" as="toplinks-header" htmlTag="div"
                           htmlClass="toplinks-wrapper">
                    <block class="Magento\Framework\View\Element\Html\Links" name="top.links">
                        <arguments>
                            <argument name="css_class" xsi:type="string">header links</argument>
                        </arguments>
                    </block>
                </container>

                <block class="Magento\Theme\Block\Html\Header\Logo" name="logo_theme">
                    <arguments>
                        <argument name="logo_img_width" xsi:type="number">142</argument>
                        <argument name="logo_img_height" xsi:type="number">42</argument>
                    </arguments>
                </block>

                <block class="Magento\Theme\Block\Html\Topmenu" name="horizontal-css"
                       template="html/horizontal-css.phtml" ttl="3600" before="-"/>

                <container name="navigation.mobile">
                    <block class="Magento\Theme\Block\Html\Topmenu" name="nav.mobile" template="html/nav-mobile.phtml"/>
                </container>

                <container name="compare-header-link" label="Compare Header" as="compare-header-link" htmlTag="div"
                           htmlClass="compare-header-wrapper"/>

                <container name="language-header" label="Language" as="language-header" htmlTag="div"
                           htmlClass="language-wrapper"/>
                <container name="currency-header" label="Currency" as="currency-header" htmlTag="div"
                           htmlClass="currency-wrapper"/>
                <container name="logo-header" label="Search" as="logo-header" htmlTag="div" htmlClass="logo-wrapper"/>

                <container name="search-header" label="Search" as="search-header" htmlTag="div"
                           htmlClass="search-wrapper">
                    <block class="Magento\Framework\View\Element\Template" name="top.search" as="topSearch"
                           template="Magento_Search::form.mini.phtml"/>
                </container>

                <container name="search-header-pro" label="Search" as="search-header-pro" htmlTag="div"
                           htmlClass="search-wrapper">
                    <block class="Sm\SearchBox\Block\SearchBox" name="searchbox" as="searchbox"
                           template="Sm_SearchBox::searchbox.form.mini.phtml"/>
                </container>

                <container name="cart-header" label="Mini Cart" as="cart-header" htmlTag="div"
                           htmlClass="cart-wrapper"/>

                <container name="slideshow-header" label="Slideshow Header" as="slideshow-header" htmlTag="div"
                           htmlClass="slideshow-wrapper"/>

            </block>
        </referenceContainer>

        <referenceBlock name="top.links">
            <referenceBlock name="my-account-link" remove="true"/>

            <block class="Magento\Framework\View\Element\Html\Link\Current" name="myaccount-link"
                   before="wish-list-link">
                <arguments>
                    <argument name="template" xsi:type="string">Magento_Theme::html/myaccount-link.phtml</argument>
                </arguments>
            </block>

            <block class="Magento\Framework\View\Element\Html\Link\Current" name="checkout-link"
                   before="authorization-link">
                <arguments>
                    <argument name="template" xsi:type="string">Magento_Theme::html/checkout-link.phtml</argument>
                </arguments>
            </block>
        </referenceBlock>

        <referenceBlock name="header" remove="true"/>
        <referenceContainer name="header.panel" remove="true"/>
        <referenceBlock name="navigation.sections" remove="true"/>
        <referenceBlock name="register-link" remove="true"/>
        <referenceBlock name="sale.reorder.sidebar" remove="true"/>
        <referenceBlock name="wishlist_sidebar" remove="true"/>
        <referenceBlock name="logo" remove="true"/>

        <move element="catalog.compare.link" destination="compare-header-link"/>
        <!-- <move element="logo" destination="logo-header" before="-"/> -->
        <move element="catalog.topnav" destination="navigation-header"/>
        <move element="store.settings.currency" destination="currency-header"/>
        <move element="store.settings.language" destination="language-header"/>
        <move element="minicart" destination="cart-header"/>

        <referenceContainer name="sidebar.additional">
            <block class="Magento\Cms\Block\Block" name="product-sidebar">
                <arguments>
                    <argument name="block_id" xsi:type="string">product-sidebar</argument>
                </arguments>
            </block>
        </referenceContainer>

        <referenceContainer name="footer-container">
            <container name="footer" as="footer" label="Page Footer" htmlTag="div" htmlClass="footer footer-wrapper">
                <block class="Magento\Theme\Block\Html\Footer" name="footer.content" template="html/footer.phtml">
                    <block class="Magento\Newsletter\Block\Subscribe" name="form.subscribe.footer"
                           as="form.subscribe.footer" before="-" template="subscribe-footer.phtml"/>
                </block>
            </container>
        </referenceContainer>
<referenceBlock name="toplinks-header" remove="true" />
<referenceBlock name="logo-header" remove="true" />
<referenceBlock name="language-header" remove="true" />
<referenceBlock name="currency-header" remove="true" />
<referenceBlock name="cart-header" remove="true" />
<referenceBlock name="logo_theme" remove="true" />
    </body>
</page>
up vote 1 down vote accepted

Remove the content from pub/static/* except from .htaccess file.

From command line (navigate to magento root):

rm -rf pub/static/

Also, run:

php bin/magento cache:clean

This should regenerate the static files and refresh your cache.

  • I did as you said, unfortunately this block still sits in this place. I update my topic and also default.xml file – Sylvester Dec 6 at 21:38
  • Sorry for late reply. Did you manage to solve the problem? – Bare Feet Dec 7 at 18:54
  • 1
    Bare, yes thank you. I changed header-20 and delete section and everything is okay :) We try to resolve last issue: magento.stackexchange.com/questions/252841/… – Sylvester Dec 7 at 21:43
  • See my answer on this question. I hope it helped :) – Bare Feet Dec 7 at 22:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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