Live Search Predictions not working
This support request was posted in Flatbase by DShrev2
- DShrev2 September 21, 2017 at 5:13 pm
The live search bar on the home page of the site is showing no predictions for any term.
Completing the search brings up the expected results, but the predictive dropdown is stating “No Results Found” as the term is typed.
Juanfra Aldasoro September 21, 2017 at 6:21 pmHello,
Thank you for writing.
The problem is that you haven’t created any “Article”, and the live search functionality works with Articles. The main WordPress search functionality (the one you see when you hit enter) includes all the different post types.
Best,
Juan.DShrev2 September 22, 2017 at 2:01 pmWith many major plugins being ill-equipped to work with custom, non-Post post types (including Articles), is there any way that this live search can be configured to search standard Posts instead? Or FAQs, which would be a vital prediction to offer for folks searching within a Help site.
Juanfra Aldasoro September 22, 2017 at 2:22 pmHi,
Thanks for the follow-up. I understand, please have in mind that the main theme functionality is prepared to work with the articles post type.
However, you can use a filter to select which post type you’d like to use in the live search functionality. You will need to use this function in your functions.php file:
Best,
Juan.DShrev2 October 17, 2017 at 1:53 pmJuan–
We’ve entered this function into our child theme functions.php file and it doesn’t seem to be effecting the live predictions.
Juanfra Aldasoro October 17, 2017 at 5:46 pmHello,
Thank you for the follow-up.
That code works for modifying the custom post types affected when using the live search. If you want to only use the native posts, then you need to re-initialize the $post_types array, and then add the ‘post’ value.
Best,
Juan.Juanfra Aldasoro October 17, 2017 at 9:45 pmHello,
Thanks for the follow-up.
This is what I mean: https://gist.github.com/juanfra/710ed9eac377f735a1dc81d3253398f9
Best,
Juan.
You must be logged in to reply to this topic.