1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. Posts Table Pro Shortcode Options
  5. Posts table filters

Posts table filters

The filters option in Posts Table Pro allows you to display dropdown lists above your table which allow users to filter (i.e. search) the table by selecting an item from the list. For example, you can use the categories filter to select a category from the list – this will filter the table to show posts from that category.

Note: This page covers the options for letting your users filter the table to narrow down the list of posts. If you want to create tables listing specific posts based on their category/date/tags etc. (i.e. perform a filter before the table first loads), check out this article instead.

WordPress table post filters

How to add filter dropdowns above the table

To show filters based on the contents of the table, add filters="true" to the Posts Table Pro shortcode. This will show all filterable columns as filters above your table.

This example would show categories and tags as search filters:
[posts_table columns="title,categories,tags" filters="true"]

To specify which filters are shown (regardless of the columns displayed), you can list the filters to be included, e.g:
[posts_table columns="image,title,content" filters="categories,tax:my_taxonomy"]

You can enable filters for: categories, tags, author and any custom taxonomy. At the present time, you cannot enable filters for a custom field.

The filters are displayed above the table by default, but if you have positioned the search box below the table, then the filters will also appear below the table.

Can I show the filters before the table loads?

Unfortunately not. The filters can only be appear above the table. They are designed to refine the items in the table, and not to perform a filter before the table first loads.

Can I control the order of the dropdown items?

The filter dropdown lists are ordered alphabetically and there are no options to change them.

If you’re using the filters to list something where alphabetical sorting isn’t appropriate (e.g. dates), then you could add numbers before each item to control the order. For example, if you’re using categories to filter by month, then you could name your categories ’01 – January’, ’02 – February’, and so on.

Was this article helpful?

Related Articles