cancel
Showing results for 
Search instead for 
Did you mean: 

searchbox

SOLVED

searchbox

How to add search box in header in magento2

1 ACCEPTED SOLUTION

Accepted Solutions

Re: searchbox

Hi @saikat _saha 

 

You can move search to header by adding this code in theme's default.xml file.

 

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<container name="header.main.search" htmlTag="div" htmlClass="header-search" after="-">
<block class="Magento\Framework\View\Element\Template" template="Magento_Search::form.mini.phtml" />
</container>
<move element="header.main.search" destination="header-wrapper" after="logo" />
<move element="top.links" destination="header-wrapper" after="header.main.search" />
</body>
</page>

I hope it will help you.

 

Thanks

 

--

if issue solved and help ,Click Kudos & Accept as Solution

View solution in original post

4 REPLIES 4

Re: searchbox

Hi @saikat _saha 

 

You can move search to header by adding this code in theme's default.xml file.

 

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<container name="header.main.search" htmlTag="div" htmlClass="header-search" after="-">
<block class="Magento\Framework\View\Element\Template" template="Magento_Search::form.mini.phtml" />
</container>
<move element="header.main.search" destination="header-wrapper" after="logo" />
<move element="top.links" destination="header-wrapper" after="header.main.search" />
</body>
</page>

I hope it will help you.

 

Thanks

 

--

if issue solved and help ,Click Kudos & Accept as Solution

Re: searchbox

Actually i am new to magento and i want searchbox for inner pages for this website https://www.researchonglobalmarkets.com/

Re: searchbox

Can you please share a inner page path where exactly you need search box?

 

Thanks

Re: searchbox

I have followed all the steps and now my issue is solved for the site https://campingio.com/ thanks for sharing.