1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. FAQ

Searching the posts table

Posts Table Pro has a range of search options which make it easy for people to find items by typing a search term. Use it alone or with filters, in which people can refine the list of posts by selecting from a set of pre-defined filter options.

The plugin provides two types of search box:

It is also possible to use the Posts Table Pro layout on your sitewide search results pages. This is a developer-level task and we have provided a separate article on how to do this.

Search box above the table

By default, Posts Table Pro displays tables with a search box above the table or grid. This allows people to instantly filter the table to view items with a specific keyword or search term.

In this example, the user has typed the term "policy" into the search box. This has filtered the table to the 2 items which match that term:

Posts Table Pro Search Term Option
A posts table with a search box to the top right of the table

There are options to change the position of the search box or hide it altogether.

Posts Table Pro standalone search box

As well as being able to display a search box above the table, you can use a widget or shortcode to add a search box anywhere on your site (e.g. the homepage). This allows people to enter a search term before viewing the posts table.

The styling of the standalone search is inherited from the default search box which comes from WordPress and your theme. You can change the styling using custom CSS.

Widget

If your theme has a sidebar area then you can add the search widget to it:

  1. Go to Appearance → Widgets (or the Customizer if you prefer to edit widgets there).
  2. Add the 'Posts Table Pro: Search Box' widget to one of your sidebars.
  3. Add any or all of the following information:
    1. Title - The title to be displayed above the widget, e.g. "Search Articles".
    2. Placeholder - The watermark text which will appear inside the search field, e.g. "Search Members".
    3. Button Text - If required, then you can change the text which appears on the button.

Shortcode

The following shortcode will add a search box anywhere on your site:

[ptp_search]

You can customize the shortcode using the placeholder and button_text parameters, for example: [ptp_search placeholder="Search resources" button_text="Search Now"]

Search results page

Posts Table Pro creates a page for displaying the search results. You can find this in the list of 'Pages' in the WordPress admin.

This search results page uses the default template from your theme. This means that if your theme's default template has a sidebar then the same sidebar will appear on the search results, otherwise it will be full-width.

The slug of this page is 'posts-search' by default. If you like, then you can change the permalink/slug to anything you like, e.g. 'search-members'.

Search logic

The search box searches the data in your table, so users can search by the contents of any column - including categories, tags, dates, custom fields and taxonomies.

The search also treats characters with and without accents as interchangeable, so searching for "Zurich" will match "Zürich" in the table.

You can make the search more advanced by using Posts Table Pro with the SearchWP plugin. This allows you to choose exactly what data is searchable, keep search analytics, search within the content of PDF documents, and more.

We have a separate article about how to do this.

Search term option

You can pre-filter the contents of the table when it is first displayed. To do this, add the search_term option to your shortcode. E.g.

[posts_table search_term="policy"]

Notes:

  1. The search is case insensitive.
  2. As with the main WordPress search, the search is done by keyword, not individual words. So if you use search_term="policy1", then it will match items with the name "policy1", "policy12", "Policy1 - HR", etc.

FAQ

Yes. There are a few ways to do this:

  • Enable the Unique table URLs option. The table then generates a unique URL that reflects its current search, filters, sorting and pagination. Apply the search and filters you want on the front end, then copy the URL from your browser's address bar and link to it as required.
  • Use the search_term shortcode option (described above) to create a table that is pre-filtered for a specific search term.
  • Generate the URLs using the standalone search box which comes with Posts Table Pro. The search results page for the standalone search box generates a unique URL for each search, so you can link to these URLs as required. This is the format for linking to a specific search term (in this case, we are doing a search for 'policy'): https://yourwebsite.com/search-results/?ptp_search=policy (Note: If you have changed the slug for the search results page then you should update search-results in the URL with the new slug.)

Can I load a pre-filtered table and then allow users to expand the selection to view all posts?

Some people like to use the search_term option to create a pre-filtered table, while giving their users the option to remove the search term and view a wider selection of posts that don't match this keyword.

Use the search term option to filter the table by a specific keyword, as described above. Your users can then delete the keyword from the search box. The table will re-load with all possible posts, including those that don't match that keyword.

Can I search the contents of PDF's or documents in the table?

The search box provided by the Posts Table Pro plugin searches the data in your table, but it cannot search the contents of PDFs or downloadable files that you are linking to from the table.

These are our suggestions:

  • ​​Instead of letting people search the contents of files, you can use categories, tags, or custom taxonomies to label each item with the keywords that people are likely to be searching for (you can create custom taxonomies with the free Easy Post Types and Fields plugin easily). You can then add these as filter dropdowns above the table, providing an easy way for people to find items with these keywords even though they can't search within the PDF or file download itself.
  • Alternatively, use Posts Table Pro with the SearchWP plugin (see setup instructions). This allows you to search within the contents of PDF's and certain other file types.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.