Download the PHP package amostajo/wordpress-search-typeahead without Composer
On this page you can find all versions of the php package amostajo/wordpress-search-typeahead. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package wordpress-search-typeahead
Wordpress Search Typeahead ADD-ON
Add-on package for Wordpress Plugin Template and Wordpress Theme Template exclusively.
Typeahead integrates Twitter's typeahead with wordpress, providing a flexible way to add customization and functionality for post searches.
- Installation
- Configure in Template
- Usage
- On Templates
- Changing filters
- Hooks
- Customization
- On Templates
- Coding Guidelines
- Copyright
Installation
This package requires Composer.
Add it in your composer.json
file located on your template's root folder:
Then run
or
to download package and dependencies.
Configure in Template
Add the following string line in your addons
array option located at your template's config file.
This should be added to:
config\plugin.php
on Wordpress Plugin Templateconfig\theme.php
on Wordpress Theme Template
Usage
On Templates
Call typeahead_search()
function within your template, like this:
Changing filters
Typeahead uses WP_Query to retrieve posts, you can modify the results of the search like this:
Hooks
FILTER: addon_typeahead_query
Filters the arguments passed to WP_Query by default.
FILTER: addon_typeahead_post
Filters each WP_Post object returned by WP_Query.
If this is not modified, the add-on will convert the post result into a Post model (located in this package).
FILTER: addon_typeahead_data
Filters final results. Receives the data as array and the search arguments (those used for WP_Query).
Customization
All views located at the views
folder can be customized in your theme. Copy and paste them in your theme (same as you would do for plugin views) and modify them.
Things to consider:
data-onselect
will make results to redirect to post permalink once selected.
Try to keep the other data
attributes, modify them if needed.
Coding Guidelines
The coding is a mix between PSR-2 and Wordpress PHP guidelines.
License
Search Typeahead is free software distributed under the terms of the MIT license.