Integrate with the Pods plugin
This add-on lets you create facets based on Pods (meta-based) custom fields.
Settings > FacetWP and create a new facet.
In the facet’s “Data source” dropdown, you’ll see a new
Pods header with all the fields you’ve created. Just choose one of these Pods fields.
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.