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

    Hi,
    Is it possible to add Ajax Search (normally in main menu) to Header meta position? Or is it possible to add this to a submenu?
    I know how to add the regular search function, but i would like to add the ajax search function with only search icon (and ‘search popup’).

    #944412

    Hey Roel,

    Thank you for using Enfold.

    Yes, this is possible. Just duplicate the default search icon filter and modify it a bit. Add it in the functions.php file.

    /*  Header Meta Search Icon */
    if(!function_exists('avia_append_header_meta_search_icon'))
    {
    	//first append search item to main menu
    	add_filter( 'wp_nav_menu_items', 'avia_append_header_meta_search_icon', 9997, 2 );
    	add_filter( 'avf_fallback_menu_items', 'avia_append_header_meta_search_icon', 9997, 2 );
    
    	function avia_append_header_meta_search_icon( $items, $args )
    	{		
    	    if (is_object($args) && $args->theme_location == 'avia2')
    	    {
    			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 menu-item-avia-special">
    							<a href="?s=" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'><span class="avia_hidden_link_text">'.__('Search','avia_framework').'</span></a>
    	        		   </li>';
    	    }
    	    return $items;
    	}
    }

    Best regards,
    Ismael

    #1143008

    Hi,
    I used that code and the search icon appeared on right side, i would like change the position to left side, after other icons, look the image attached (links).
    Dropbox: https://www.dropbox.com/s/0e2r99cpofgh8wf/search.png?dl=0 or
    Wetransfer: https://we.tl/t-KBJr388hAQ

    #1143227

    Hi,

    Thank you for the inquiry.

    This is possible, but you have to move the secondary menu to the left side of the header. Or try this css code.

    #header_meta #menu-item-search {
    	position: absolute;
    	right: 500px;
    }
    

    Best regards,
    Ismael

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