Tagged: Search Bar, shortcode
I created a simple shortcode to display the Enfold search bar, but the auto complete search results are not working.
Any ideas on what I need to do to make it work?
add_shortcode( ‘searchbar’, ‘searchbar’ );
function searchbar( ) {
return get_search_form();
}
Hey hookedonweb,
Thank you for using Enfold.
Please replace the code with the following.
add_shortcode( 'searchbar', 'searchbar' );
function searchbar() {
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;
}
// set sidebar height
add_action( 'wp_footer', 'ava_custom_script' );
function ava_custom_script() { ?>
<script type="text/javascript">
(function($){
$(window).load(function() {
new $.AviaAjaxSearch({scope:'body'});
});
})(jQuery);
</script>
<?php
}
Best regards,
Ismael