[Resolved] Navigation search feature inside secondary nav

Home Forums Support [Resolved] Navigation search feature inside secondary nav

Home Forums Support Navigation search feature inside secondary nav

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #359566
    Anthony

    Hi Tom,

    I want to keep the fixed option for my primary nav but move the search feature inside the secondary nav.

    Browsing through the forum I saw this code to insert a search field inside my secondary menu

    add_filter('wp_nav_menu_items','add_search_box', 10, 2);
    function add_search_box($items, $args) {
        if( $args->theme_location == 'secondary')  {
            ob_start();
            get_search_form();
            $searchform = ob_get_contents();
            ob_end_clean();
            $items .= '<li class="search-item" title="Search"><a href="#"><i class="fa fa-fw fa-search" aria-hidden="true"></i><span class="screen-reader-text">Search</span></a></li>';
        }
        return $items;
    }

    It outputs a full search form, but I’d prefer to replicate the exact same behaviour than the default search feature in the primary nav (a search icon that reveals the search field on click).

    What is the best way to do it?

    #359723
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Currently it’s not possible, but it is a planned feature.

    #400358
    Robert

    Thought I saw a solution some where, is this possible?

    #400376
    Tom
    Lead Developer
    Lead Developer

    Not currently, but should be in the next version of GP.

    #400754
    Robert

    Gotcha gotcha. It’s surprising that really no such plugin exists for this simple feature. Many themes have it custom built but I haven’t seen a simple solution. I’m about to try to fumble through building one. I’ll look for it in the next version of GP though!

    P.S. When is that coming out? lol.

    #401044
    Tom
    Lead Developer
    Lead Developer

    Likely in a week or two πŸ™‚

    #483478
    John Dowling

    Any news on this front?

    #483949
    Tom
    Lead Developer
    Lead Developer
    #484570
    John Dowling

    Works great!

    #484636
    Tom
    Lead Developer
    Lead Developer

    Awesome! πŸ™‚

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.