Hi @shefa7
Yes, you can use this plugin, because it’s an extension of WP_Query() (integrated WP search).
You can modify either default search (which runs when you enter a search query in the standard Search widget) or add your own searches with separate widgets and even have multiple searches on your website.
This is a short instruction on how can you modify your MAIN search:
(add this code to your functions.php)
——->8——————-
add_action('pre_get_posts', function(&$wpq)
{
if ($wpq->is_main_query() && (!is_admin()) && is_search()) {
// Here you can modify default WP_Query() parameters
$wpq->set('post_type', array('post', 'page', 'mycustom_post_type', '.....'));
// ... add other parameters
}
}, 8);
————–8<————-
In case you don’t want to modify your main search, you can add new searches. Here is how you can do it:
(again, add this code to your functions.php)
——–>8——————-
// Let’s add new search preset
add_action ('init', function()
{
global $wpfts_core;
if ((!is_object($wpfts_core)) || (!$wpfts_core)) {
return;
}
if (method_exists($wpfts_core, 'AddWidgetPreset')) {
$wpfts_core->AddWidgetPreset('mypreset1', array(
'title' => 'My Preset 1',
'filter' => 'mypreset1',
'results_url' => '/',
'autocomplete_mode' => 1,
));
}
}, 255);
// And now we need to add one more method to process new preset
add_action('wpfts_pre_get_posts', function(&$wpq, $wdata)
{
if ($wdata['id'] == 'mypreset1') {
// Let's set up specific parameters for this module
$wpq->set('post_type', array('mycustom_post_type'));
}
}, 20, 2);
————–8<————-
After that, you need to use another widget “WPFTS :: Live Search” and select your preset in widget’s config.
Nothing too complex. If you will need some help – please write me back or read this documentation:
https://fulltextsearch.org/documentation/
Thanks!