ElasticPress
ElasticPress copied to clipboard
Autosuggest V2
Description of the Change
New Feature: Autosuggest V2 This uses the Post Search API and filterable React components. By default it matches the appearance of Autosuggest V1:
Available PHP hooks:
- ep_autosuggest_v2_per_page - Modify count of results returned
Available JS hooks:
- ep.Autosuggest.queryParams - Modify search query parameters
- ep.Autosuggest.suggestions - Filter search results
- ep.Autosuggest.suggestionItem - Customize individual suggestion item rendering
- ep.Autosuggest.suggestionList - Customize suggestion list rendering
- ep.Autosuggest.onItemClick - Triggered when a suggestion item is clicked
Available Events:
- ep_autosuggest_loaded - window.EPAutosuggest is available - safe to hook into ui overrides
More information on the hooks is available in the autosuggest-v2 readme
Here's the result of some child theme hook customizations:
How to test the Change
- Enable the feature in ElasticPress
- Confirm the appearance is identical to Autosuggest V1
- (If desired) In your theme or from another plugin, add and test out some hooks. Reference autosuggest-v2's readme.md for premade hooks.
Changelog Entry
Added - New feature: Autosuggest V2
Credits
Props @ZacharyRener
Checklist:
- [x] I agree to follow this project's Code of Conduct.
- [x] I have updated the documentation accordingly.
- [x] I have added Critical Flows, Test Cases, and/or End-to-End Tests to cover my change.
- [x] All new and existing tests pass.