Using FacetWP to add filter widgets to your post tables
Posts Table Pro works seamlessly together with FacetWP so that you can add filter widgets to your tables like this:
Follow the instructions below to integrate your post tables with FacetWP.
This article contains general advice about how to display a posts table in your FacetWP results listing. This is advanced usage of Posts Table Pro and isn't covered by our standard plugin support.
1. Create a Listing template via the Listing Builder in FacetWP
Browse to Settings → FacetWP → Listings and click “Add new”. Then follow the instructions below to allow Posts Table Pro to recognise that it will be handling the output for your template.
- Ensure the template slug begins with
- Ignore the options on the Display tab because these will automatically be replaced by the posts table.
- On the Query tab, set up your query as needed to choose which posts to display. The 'Post Type selected in Settings → Posts Table Pro will be ignored, so you need to select which Post Type(s) to display here in FacetWP. You can also select specific categories/tags/taxonomies to display here.
The other details of the posts table (e.g. the columns) are taken from Settings → Posts Table Pro. Since FacetWP will be handling the filtering, the usual Posts Table Pro filter dropdowns and search box will automatically be hidden from the posts table.
2. Set up your filters
Create your filters (i.e. facets) by following the FacetWP instructions. Only the Pager facet is not supported as this is automatically handled by Posts Table Pro.
3. Connect it all together
Now you can create a filtering page using the above Listing template and facets via the shortcodes or PHP functions provided by FacetWP.
For example, the following shortcodes would create a page that contains a post table, search box, and 2 filter widgets:
Can I edit each tables individually when using FacetWP?
Since the tables are added via a FacetWP Listing template instead of using the
[posts_table] shortcode, you can't use shortcode options to edit each table individually. Each table will display the posts which you selected using the Query Builder in the template and will inherit the global options in terms of the columns,
Instead, we have provided a filter which allows developers to adjust the options supplied to the posts table.