The Filters add-on provides front-end and admin functionality for creating, managing and displaying Ajax Load More filters.
A no-coding required solution that makes filtering with Ajax Load More easy and intuitive for both developers and users.
How It Works
The Filters add-on works by rendering Ajax filter controls (via shortcode) that target and hook into a single Ajax Load More instance. When a user interacts with a filter, the add-on generates a modified query object and passes the query to Ajax Load More for display.
Each time a filter is run, Ajax Load More generates a unique browser URL based on the selected filter parameters. Users are then able to share a direct URL to filtered content or use their forward and back buttons to browse previous filter states.
On the back-end, Filters are created using the filter management tool which provides functionality for building and managing all the various filter combinations and options. The management tool allows you to select a query parameter, choose the form element style and even allows you to chain filters together to create an advanced filtering form.
It’s a tool for both the back-end and front-end of your website that allows you to create complex filter queries without writing a single line of code.
The following is a basic filtering example using a category filter with a radio button field type. Notice that when you make a filter selection both the browser URL and the Ajax Load More content update.
Select a Category
Infinite scrolling WooCommerce shop and product archives.
As a Connekt affiliate you will earn 25% commission on each successful sale.
Filtering posts by category, tag and year using a variety of form element types.
Add a select/unselect all option to a group of filter checkboxes
Date Picker (Range)
Using a date picker to select a date range and return events active within the range.
Preselecting filter form values on initial page load.
A simple blog search using the textfield field type and the Search query parameter.
Displaying a stylized list of currently active filters.
Filtering WooCommerce products by category, tag or price range.
View the Implementation section below for information on how to build and load filters.
Implementing Ajax Load More Filters is essentially a three step process.
Step 1 – Create Filter and Shortcode
Start by visiting Ajax Load More > Filters in your WordPress admin and create a new filter by entering a unique ID, selecting an interaction style and building the filter blocks that will consist of your filters.
After a filter has been created and saved, the generated filter shortcode is ready to be added to a WordPress page or template for display – don’t worry if it’s not perfect, you can always go back and make edits/adjustments to the filter afterwards.
Filters Shortcode[ajax_load_more_filters id="category_filters" target="my_alm_filters"]
The above shortcode can be added to your page in the location of your choosing.
Step 2 – Create Ajax Load More Shortcode
The next step is to modify your existing Ajax Load More shortcode to allow for filters to be initiated on the Ajax Load More instance.
To do this, set filters=”true” and also set the target parameter as the filter ID. You will also want to double check the Ajax Load More ID matches the target parameter in the Filters shortcode (as seen above).
Ajax Load More Shortcode[[ajax_load_more id="my_alm_filters" filters="true" target="category_filters"]]
See the Shortcode Parameters section below for documentation on additional Filter parameters.
Step 3 – Adding the Shortcodes
The final steps is to add both the Filters and Ajax Load More shortcodes to your page or template. For this example, the shortcodes have been added directly to a custom page template using the do_shortcode implementation method.
Template Name: ALM Filter Template Example
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1><?php the_title(); ?></h1>
// Ajax Load More Shortcode
echo do_shortcode('[ajax_load_more id="my_alm_filters" filters="true" target="category_filters" post_type="post"]');
// Filters Shortcode
echo do_shortcode('[ajax_load_more_filters id="category_filters" target="my_alm_filters"]');
<?php get_footer(); ?>
When building out a filter group you can select from 7 unique form element types for user input.
Each form element type displays and functions differently, choose wisely depending on the type of filtering required.
The Checkbox field type allows users to select multiple values for a filter.
The Radio field type allows users to select a single value only for a filter.
The Select field type displays a select box and allows for a single selection.
The Star Rating field type displays stars as a rating value and uses a Custom Field query for a numeric value.
The Textfield field type displays a user input field and submit button (if selected).
The Date Picker field type uses FlatpickrJS to displays a calendar and allows for a single, multiple or date range selection.
The Range Slider field type uses the noUiSlider library to display a draggable range selector.
We’ve taken any guess work out of creating filters by building an administration tool to help you create, modify and manage filters. The tool allows you to build filter blocks based on preconfigured parameters leaving little room for error.
When a filter is created (or modified) the data is stored in the Options table of your WordPress database and then accessed on the front-end when filters are rendered for display.
One of the favorite features is the ability to chain filters together to create complex filter groups that can consist of many different query parameters.
As seen in the screenshot above, it’s as easy as clicking buttons to add and remove filter blocks as your requirements change.
The following groups of shortcode parameters are available with the Filters add-on. Please note, both the standard Ajax Load More shortcode and the Filters shortcode have a target parameter which is required to connect the filtering functionality to Ajax Load More.
This shortcode accepts two required parameters: id and target.
|id||The ID of the filter set.required|
|target||The ID of the Ajax Load More instance to target.required|
Example Shortcode[ajax_load_more_filters id="search_filters" target="alm_search_results"]
Ajax Load More Shortcode
The standard [ajax_load_more] shortcode has the following parameters to help with set up and initiation of filters.
|target||The ID of the Filters instance Ajax Load More will target .|
|filters||Enable filters with this Ajax Load More instance.(true/false)|
|filters_url||Update the browser querystring with active filters values. Default = true|
|filters_paging||Add ‘?pg=x’ to the browser querystring as users load additional pages. Default = true|
|filters_scroll||Automatically scroll users to the top of list after a filter update. Default = false|
|filters_scrolltop||The offset top position of the window used with Paging Parameters and Scroll. Default = 30|
|filters_analytics||Send pageviews to Google Analytics.(true/false)|
|filters_debug||Enable debugging of the Ajax Load More filter object in the browser console.(true/false)|
Example Shortcode[ajax_load_more id="alm_search_results" target="search_filters" filters="true"]
Once installed, the Filters add-on provides the following options in the Ajax Load More Shortcode Builder.
Upon purchase of this add-on you will receive a confirmation/purchase receipt email. Your receipt will contain a direct link for downloading your copy of Ajax Load More: Filters and a license key.
After downloading the add-on, upload the unzipped files to your /wp-content/plugins/ directory or visit your plugins dashboard and upload the downloaded .zip under Add New.
To activate your add-on and receive updates directly in your WordPress plugins dashboard users are required to enter the license key that was included with their purchase receipt.
To activate a license key:
- Visit the Licenses section within the Ajax Load More plugin.
- Enter the product key and click Activate License.
- If the status indicator turns green your add-on has been successfully activated (example below).
If you did not receive your confirmation/purchase receipt email and license key, please check your spam/junk folder and if you still cannot locate the email please contact me at darren [at] connekthq.com or use the Product Support form on the website.