Tagged: , ,

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

    Hello everybody,

    I’ve spend the last few hours looking around for a solution to get a functional search toggle working in the first part (above the slider) of the enfold theme. After fiddling around a bit I tried google but without success.

    I’m looking for a way to get the small search toggle from the menu or something similar in the part above my menu.
    Is there any way to get this working?

    I would be very happy if someone could help me.

    Thanks in advance

    jhiry

    #356493

    Hey jhiry!

    Thank you for using Enfold.

    Add this on functions.php:

    add_filter( 'wp_nav_menu_items', 'avia_append_search_top_nav', 10, 2 );
    function avia_append_search_top_nav( $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">
    						<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>';
    	}
    	return $items;
    }
    

    Make sure that you have the Header Secondary Menu enabled on Enfold > Header layout > Extra Elements panel.

    Best regards,
    Ismael

    #356826

    thank u.

    works like a charm! :)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Search toggle in "Enfold"’ is closed to new replies.