1. Go to this page and download the library: Download mrkoopie/wp_ajaxfilter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mrkoopie / wp_ajaxfilter example snippets
composer
function ajaxfilter($filter_id)
{
if(!isset($GLOBALS['WP_ajaxfilter'][$filter_id]))
$GLOBALS['WP_ajaxfilter'][$filter_id] = new MrKoopie/WP_ajaxfilter/generator($filter_id);
return $GLOBALS['WP_ajaxfilter'][$filter_id];
}
# functions.php
/**
* Here we configure the ajaxfilter with the form id your_filter_id.
* This id should be unique and is used in the template to output
* the filter and is used as a selector in jQuery.
*/
ajax_filter('your_filter_id')
// Configure the input fields
->add_checkbox(__('Province'), 'taxonomy_province', 'optional_tech_name_province')
// The jQuery script will make an ajax call, set the
// template filter here. The filter will use
// get_template_part('your_ajax_template'), so you
// can use the same input method.
->set_ajax_template('your_ajax_template')
// By running render, we activate the query filter
// and create the ajax listener.
->render();
# template.php
/**
* This command outputs the HTML form. Keep in mind that you have to put
* a <div id="your_filter_id"></div> somewere!
*/
ajax_filter('your_filter_id')->html();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.