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
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
thank u.
works like a charm! :)