Download the PHP package mrkoopie/wp_ajaxfilter without Composer
On this page you can find all versions of the php package mrkoopie/wp_ajaxfilter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mrkoopie/wp_ajaxfilter
More information about mrkoopie/wp_ajaxfilter
Files in mrkoopie/wp_ajaxfilter
Package wp_ajaxfilter
Short Description Generate HTML forms and filter archive data in WordPress
License
Informations about the package wp_ajaxfilter
WP_ajaxfilter
This package is developed to be a part of a WordPress theme or plugin. By installing this code you can add an advanced filter without writing every piece of HTML, PHP, javascript and CSS code. The package is still in development and may not
How to install
Run the following command:
Add to your functions.php the following code:
How to use the code in a theme
The code is designed to have a controller inside your functions.php (or any file that is included in your functions.php) and a simple call in a template file.
add_checkbox($label, $taxonomy_id, $tech_name )
$label is shown in the
set_ajax_template($template_name)
$template_name is the name of your template inside your theme. This template is used to show the results of the filter.
render()
With this function the query filter is set and the ajax call is registered.
How to override the stubs
- Create in your theme the directory overrides/wp_ajaxfilter_stubs/.
- Create every stub file that you want to override there.
The stubs are designed to be flexible and should allow you to create the correct styling. If you feel this is not the case, please make a pull request with an improved stub file.
Todo
Add support for:
- Comparison methods
TODO: add_dropdown($label, $taxonomy_id, $tech_name )
$label is shown in the
TODO: add_radiobuttons($label, $taxonomy_id, $tech_name )
$label is shown in the
TODO: add_text($label, $field = 's', $tech_name )
$label is shown in the
FAQ
Why is this not a plugin?
A plugin would require a GUI in the back-end, which is not provided by this package. This package is designed to be used within a theme or a plugin, to make the life of a developer easier.
Why are you using Mockery for mocking?
The developers of Prophecy did not include support for magic functions like call(). Although they do have a point, in this case we need to use call in order to mock WordPress functions without predefining every possible WordPress function.
Credits
Jasper Kums, Eenvoud Media B.V. - For providing feedback.