Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #186741

    Hi Kriesi,

    I like to have the search field (box) in the menubar instead of a drop down on click of icon. Can you please tell me the changes that would be required?

    And I need the field to be in the middle of the menu items. Is it possible to have search field in the middle of the menu items , instead of appending at the last?

    Thanks,
    Neven

    #187233

    Hi fsatechnology!

    I didn’t test the modification but you should be able to replace the icon with the search form. In functions-enfold.php replace

    
    	    if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu"))
    	    {
    	        global $avia_config;
    	        ob_start();
    	        get_search_form();
    	        $form =  htmlspecialchars(ob_get_clean()) ;
    
    	        $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown"><a href="?s=" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'></a></li>';
    	    }
    	    return $items;
    

    with

    
    	    if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu"))
    	    {
    	        global $avia_config;
    	        ob_start();
    	        get_search_form();
    	        $form =  htmlspecialchars(ob_get_clean()) ;
    
    	        $items .= '<li id="menu-item-search-form" class="noMobile menu-item">'.$form.'</li>';
    	    }
    	    return $items;
    

    However the function does not allow you to place the search form in anywhere you want to – you can only insert it at the very beginning or at the very end of the menu.

    Regards,
    Peter

    #187641

    Hi Peter,

    Thanks for the help. The code worked except for small change.

    I replaced

    $form = htmlspecialchars(ob_get_clean()) ;

    with

    $form = ob_get_clean() ;

    Thanks and regards,
    Neven

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Search field or box in menu bar instead of search icon’ is closed to new replies.