Integrate with the Pods plugin
This add-on lets you create facets based on (meta-based) custom fields made with the Pods plugin. From version 1.2.3, you can also use Pods custom fields in FacetWP’s Listing Builder and in Sort facets.
This add-on requires Pods version 2.7.9+.
Settings > FacetWP and create a new facet.
In the facet’s “Data source” dropdown, you’ll see a “Pods” header with all the fields you’ve created. Just choose one of these Pods fields.
To use Pods fields in the Listing Builder, in the “Display” tab, select the field from the Listing Builder’s item selection dropdown when adding a new item. In the “Query” tab, Pods fields can be chosen in the “Sort by” or “Narrow results by” dropdowns.
In a Sort facets “Sort options” setting, Pods custom fields can be selected as fields to sort by.
Settings > FacetWP > Templates and create a new FacetWP listing template.
When on the “Display” tab, click the “Switch to advanced mode” link on the right side. Here’s an example of what to use for the
Display Code box:
<?php while ( have_posts() ): the_post(); ?> <?php echo pods( 'your_pod_name', get_the_id() )->template( 'Your Pods Template Name' ); ?> <?php endwhile; ?>
Finally, click on the “Query” tab to define which post type(s) to fetch, and other query-related settings.
With Pods, you can add custom fields to taxonomy terms. When you set such a custom term field as the data source in a facet, you will notice that the facet does not display any choices. This is because custom fields attached to taxonomy terms cannot be indexed directly by FacetWP.
However, with a bit of custom code, using a custom term field as data source is possible. See this section on the Advanced Custom Fields page. The instructions and custom code for Pods are exactly the same.
If you are looking into increasing the loading speed of your (facet) pages and you are using Pods, experiment with the Pods Alternative Cache add-on plugin, especially if you are hosting your site on WP Engine.
Pods Alternative Cache is a good alternative for Pods’ built-in cache if your site already uses object caching. It provides better performance of Pods sites on hosting plans where object cache sizes are limited or object caching is unavailable. It was developed for and tested on the WP Engine platform to improve the performance of cached objects generated from Pods, but it works on other hosting providers too.
For large Pods installations with hundreds of Pods and fields, having them all stored in the object cache can cause the object cache itself to become ineffective because it will constantly run out of space and trash Pods objects (or other useful cached objects from WordPress, the theme, or plugins). The add-on allows Pods to use more consistent persistent caching without affecting other plugins and WordPress caching objects.
More info about Pods Alternative Cache add-on can be found here.
For even further optimization of Pods on your site, you could look into leveraging Pods Alternative Cache by using partial page caching.
- Fixed indexing issue for certain Pods pick fields (single-select taxonomy sources)
- Fixed display all Pods fields (for use within the Layout Builder and/or Query builder)
- Fixed issue with pick (relationship) fields that aren't predefined lists