Limited Time Sale - 10% Discount! Use Code:U5ZBQTEY

Custom Field Filter

This document explains how to use the custom field filter available in the Divi FilterGrid plugin.

Divi FilterGrid has a Show Custom Fields option available in the module’s Content tab -> Posts Elements section that will allow you to display one or more custom fields. You can display custom fields, optionally display labels for each field, and arrange the order of the fields however you like using a drag-n-drop interface.

The custom field filter will allow you to intercept the output of each field and modify its value. A good use case would be a custom field with a date or number value that is saved in a format that needs to be modified. Below is an example of how you can use the filter to change the number format of the WooCommerce price:

In the example above, we are checking if the custom field is the WooCommerce _price custom field. If yes, we are then modifying the number format to always include two digits to the right of the decimal. If there are multiple custom fields that need to be modified, we could simply add multiple if statements for each field.

While the custom field filter is limited to modifying the output of custom field values, Divi FilterGrid also has a custom content filter that will allow you to implement more complex code.

Pin It on Pinterest

Share This