Main menu add search field - by onestop - on WordPress WooCommerce support

This topic has 14 replies, 3 voices, and was last updated 10 years, 5 months ago ago by Eva Kemp

  • Avatar: onestop
    onestop
    Participant
    July 5, 2014 at 06:14

    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

    13 Answers
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 5, 2014 at 07:07

    Hello,

    Please provide us with wp-admin and FTP credentials.

    Regards,
    Jack Richardson

    Avatar: onestop
    onestop
    Participant
    July 5, 2014 at 12:11

    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.

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 5, 2014 at 12:39

    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

    Avatar: Eva
    Eva Kemp
    Support staff
    July 5, 2014 at 13:32

    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.

    Avatar: onestop
    onestop
    Participant
    July 7, 2014 at 06:18

    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/

    Please, contact administrator
    for this information.
    Avatar: Eva
    Eva Kemp
    Support staff
    July 7, 2014 at 08:37

    Hello,

    As I see the search box is showing fine:

    Please specify where you want it to be displayed.

    Regards,
    Eva Kemp.

    Avatar: onestop
    onestop
    Participant
    July 7, 2014 at 08:44

    As i said it is working but its not inside the<li> which is where i want it to be!

    Avatar: onestop
    onestop
    Participant
    July 7, 2014 at 08:57

    …. inside the li of the menu li class=”menu-header-search

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 7, 2014 at 09:39

    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

    Avatar: onestop
    onestop
    Participant
    July 7, 2014 at 09:48

    in the last li of the menu with class”menu-header-search” which is what add_filter should be doing in functions.php

    img

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 7, 2014 at 10:33

    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

    Avatar: onestop
    onestop
    Participant
    July 8, 2014 at 04:33

    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;
    }
    
    Avatar: Eva
    Eva Kemp
    Support staff
    July 8, 2014 at 11:02

    Hello,

    We’re glad you’ve managed to fix the issue.
    That’s great!

    Enjoy your work!
    Regards,
    Eva Kemp.

  • Viewing 14 results - 1 through 14 (of 14 total)

The issue related to '‘main menu add search field’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.