This is a class implementation of the wp.tuts+ tutorial: Add jQuery Autocomplete to Your Site’s Search

In the tutorial the javascript is inside a seperate file. For convenience for me- and because I feel the script is small enough - in this class I am printing the script in the footer (after the necessary jQuery files). Generally you should follow the method outlined in the tutorial.

This can be used as-is inside a functions.php or a plug-in. Whichever you feel is more appropriate for your use case.

The class properties are

  • action: The name to identify the ajax action corresponding to generating a suggestion list. Should be unique to you and the action.


Stephen Harris http://profiles.wordpress.org/stephenh1988/

Github: https://github.com/stephenh1988