ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

Autosuggest: Document window.epAutosuggestItemHTMLFilter

Open felipeelia opened this issue 3 years ago • 1 comments

Is your enhancement related to a problem? Please describe.

Although it is currently possible to change the autosuggest output, we don't have that properly documented.

Describe the solution you'd like An addition to the Theme Integration page seems the best place to explain how to use the window.epAutosuggestItemHTMLFilter function.

An example I've recently shared that can serve as a starting point:

window.epAutosuggestItemHTMLFilter = function(itemHTML, doc, i, value) {
    return '<li><a href="' + doc._source.permalink + '"><img src="' + doc._source.thumbnail.src + '">' + doc._source.post_title + '</a></li>';
}

felipeelia avatar May 18 '22 19:05 felipeelia

I'll look into this and will add documentation on how to use it properly.

MARQAS avatar May 19 '22 12:05 MARQAS