Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #371519

    Hi,

    Please see my site

    http://pro4life.co.uk

    I would like to know how to put the search bar to the left of the main menu (to the left of “Delivery”)

    I have given adding get_search_form(); to the helper-main-menu.php file, but i’m not sure whether this is correct or where to place it?

    Any help would be amazing!

    #371542

    Hi hloft!

    Thank you for coming back.

    If you are using a child theme, put in functions.php of the child theme at the bottom:

    
    if(!function_exists('avia_append_search_nav'))
    {
    	//first append search item to main menu
    	add_filter( 'wp_nav_menu_items', 'avia_append_search_nav', 10, 2 );
    	add_filter( 'avf_fallback_menu_items', 'avia_append_search_nav', 10, 2 );
    
    	function avia_append_search_nav ( $items, $args )
    	{	
    		if(avia_get_option('header_searchicon','header_searchicon') != "header_searchicon") return $items;
    		if(avia_get_option('header_position',  'header_top') != "header_top") return $items;
    
    		
    	    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=" rel="nofollow" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'><span class="avia_hidden_link_text">'.__('Search','avia_framework').'</span></a>
    	        		   </li>' . $items;
    	    }
    	    return $items;
    	}
    }
    
    

    If you are using enfold parent theme, then put this code at the beginning of functions.php.

    Best regards,
    Günter

    #371546

    Thank you Günter, that has worked!

    #371550

    Hi!

    Glad I could help you. Enjoy the theme.

    Regards,
    Günter

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Search bar to the left of the main menu’ is closed to new replies.