This topic has 14 replies, 3 voices, and was last updated 10 years, 5 months ago ago by Eva Kemp
Hi, trying to add the search field (searchform.php) to the main menu but i cant find which file you have the menu in?
if possible i want it to be in the last li of the main menu, but the only ref i can find is in the code/functions.php (line 190)
any idea ?
thanks
Hello,
Please provide us with wp-admin and FTP credentials.
Regards,
Jack Richardson
Hi jack, is it possible for u to tell me what what to change or which file I need?
As I don’t have it online at moment.
Hello,
We’re sorry but it is very difficult to help you without access to your site! We advise you to contact us when your site will be online and we’ll try to help you out.
Regards,
Jack Richardson
Hello,
You can try to add the search box to your menu as described in this article: http://bavotasan.com/2011/adding-a-search-bar-to-the-nav-menu-in-wordpress/
or use some plugin (for example, http://wordpress.org/plugins/search-box-on-navigation-menu/).
Regards,
Eva Kemp.
Thanks Eva, iv tried that but it didn’t work! but iv found this one http://wordpress.stackexchange.com/a/2144/35876
which does work… sort of but the search form is out side the li ?
my site online now: http://www.onestopdive.com/dev/
Hello,
As I see the search box is showing fine:
Please specify where you want it to be displayed.
Regards,
Eva Kemp.
As i said it is working but its not inside the<li>
which is where i want it to be!
…. inside the li of the menu li class=”menu-header-search
Hello,
Could you please clarify us with the meaning of this? Maybe you want to insert search form in drop down menu?
Regards,
Jack Richardson
in the last li of the menu with class”menu-header-search” which is what add_filter should be doing in functions.php
Hello,
We don’t set up clients customization. We advised you how to get search form in the main menu and if you want further our help you need to contact us on support.8theme.com and request paid customization.
Regards,
Jack Richardson
well managed to figure it out! in case any one else needs to know below is the code…
add_filter('wp_nav_menu_items','search_box_function', 10, 2);
function search_box_function( $top, $args ) {
if( $args->theme_location == 'top' )
return $top.'<li class="menu-header-search">'. get_search_form(false) .'</li>';
return $top;
}
Hello,
We’re glad you’ve managed to fix the issue.
That’s great!
Enjoy your work!
Regards,
Eva Kemp.
The issue related to '‘main menu add search field’' has been successfully resolved, and the topic is now closed for further responses