Tagged: search
Hi there, I want to use the AJAX live search function in the avia layout builder, but with custom search results. So I wrote the code needed to show only custom search results and placed it in my functions.php of my Enfold child theme. The code works for the result page, but doesnt work for the live AJAX search. How can I customize the AJAX live search? See the code below in my childtheme:
add_filter( ‘pre_get_posts’, function( $query ) {
if (!$query->is_admin && $query->is_search) {
$query->set(‘post_type’, ‘page’);
$query->set(‘post_parent__in’, array(<parent-ids>));
}
return $query;
});
Hey Bramfietst,
You need to have a look at this function avia_ajax_search in the /enfold/functions-enfold.php file.
It has the filter avf_ajax_search_query that can be used to adjust the query.
Best regards,
Victoria