Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created April 19, 2019 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jchristopher/046bb5c7a26c572c92a5521a943cc7c4 to your computer and use it in GitHub Desktop.
Save jchristopher/046bb5c7a26c572c92a5521a943cc7c4 to your computer and use it in GitHub Desktop.
Integrate Flatsome's live search with SearchWP
<?php
// Integrate Flatsome's live search with SearchWP.
function my_flatsome_searchwp_integration( $search_query, $args, $defaults ) {
if ( ! class_exists( 'SWP_Query' ) ) {
return $function;
}
$results = new SWP_Query( $args );
return $results->posts;
}
add_filter( 'flatsome_ajax_search_function', function() {
return 'my_flatsome_searchwp_integration';
}, 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment