cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.2 Moving search into navigation - with code

Magento 2.2 Moving search into navigation - with code

I'm trying to move the search bar into the navigation on Magento 2.2 using a child theme.

Currently, my magento_demo\app\design\frontend\Magento\themename\Magento_Theme\layout\default.xml file contains

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>

    <referenceBlock name="wish-list-link" remove="true" />          <!--for WishList Link-->
    <referenceBlock name="my-account-link" remove="true" />         <!--for My Account Link-->


    <referenceBlock name="logo">
        <arguments>
            <argument name="logo_file" xsi:type="string">images/mytheme-logo.png</argument>
            <argument name="logo_img_width" xsi:type="number">200</argument>
            <argument name="logo_img_height" xsi:type="number">200</argument>
        </arguments>
    </referenceBlock>
</body>

 

I've done some research and found

<move element="top.search" destination="page.top" after="catalog.topnav" />

Unfortunately, i'm having no luck with this. If anyone has a good explanation of how this works that would be great, as I will need to move a lot of elements around!

Hopefully someone will understand this, as I've ran out of options to try!