This document explains how to use the custom query option available in the Divi FilterGrid plugin.
Divi FilterGrid includes three query types:
- Basic (posts only)
- Advanced (select any post type and taxonomy from the module’s settings)
- Custom (create a custom query using a filter)
Changing the query type to Custom will bypass the query created by the module’s settings and will use a query you create. Once the Custom query type is selected, the module will look in the child theme’s functions.php file for the following filters:
Below is a basic example of how to use the filter:
The query created by this filter will be used on every instance of the module that has the Custom query type selected.
You can also use different queries for different modules. For this we’ll need to modify our filter and function to get the module’s CSS ID set in the Advanced tab of the module:
In addition to using the module’s ID, you can also use the module’s Admin Label or Class.
Admin Label – found at the bottom of the module’s Content tab:
Class – found at the top of the Advanced tab:
More complex examples can be found in this tutorial.