Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Add Search Bar to Menu instead of Widget WordPress


My Site :

I want search bar to be on the top Menu (beside the Facebook menu) instead of the sidebar

Example is like on this website :

Answers (2)


Baki Goxhaj answers:

Go to sidebar.php, find your search form and copy/paste it to your menu in a new <li>[search]</li>. It seems you don't have enough room for the for there - you might need to remove one menu item.

Jamie Kang comments:

Doesn't work. I tried this :

<li><a href="" rel="nofollow">Facebook</a></li>

<form action="<?php bloginfo('home'); ?>" method="get">
<div class="searchbox">
<input type="text" class="textfield" name="s" size="24" value="<?php echo wp_specialchars($s, 1); ?>" />
<input type="submit" class="button" value="SEARCH" />

Baki Goxhaj comments:

What do you mean does not work? You cannot see it? If yes, it is because there is not enough place for the search from on the menu and it goes on a new line which is not allowed to scroll by CSS. So, give the search box a little more space.


Oleg Butuzov answers:

1) add to menu search place holder to menu ([search])
2) use as argument 'echo'=>0 (to hide menu not show it)
3) echo srt_replace('[menu]', get_serach_form(), $menu);


Jamie Kang comments:

I'm sorry I don't understand what you're saying

Can you just give me a full code I can copy/paste somewhere

Oleg Butuzov comments:

Full code for 6$?

Jamie Kang comments:

Can I increase price on WPQuetions? Else I can give you another $10 or something privately.