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

Posts table columns

Posts Table Pro gives you full control over the data displayed in the table. You can do this using the columns option in the Posts Table Pro shortcode.

Available columns

The available columns are: id, title, content, excerptimage, date, author, categories, tags, status, or any custom field or taxonomy.

WordPress table plugin column options

Posts table with columns for title, content, summary, image, date, author, categories & tags

You can choose as many columns as you want and in any order. You must separate each column with a comma. It doesn’t matter if there are spaces before or after the comma.

Here’s an example of a shortcode to display blog posts with columns for title, date, post author and excerpt:

[posts_table columns="title,date,author,excerpt"]

  • The id column will display the post ID, which is a unique number used internally by WordPress for each post.
  • The title column is the main post title.
  • The content column will show the post content but will be truncated to 15 words. You can modify this length by setting the content_length option.
  • The excerpt column will show the post excerpt. It will be truncated to 55 words (the WordPress default) but themes and plugins sometimes override this value. To have precise control over the length, you can set the excerpt_length option.
  • The image column will display the featured image (i.e. the post thumbnail) for the post or page (see image_size option to set a custom size).
  • The date column will display the date that the post was published. The author column displays the post author’s display name.
  • The categories and tags columns apply to blog posts only (i.e. post_type="post") and will display the categories or tags for each post (comma-separated if there is more than one).
  • The status column will show the status of the post (e.g. draft, pending, publish, etc).

Custom field columns

Custom fields are a good way to include other types of content in the table. You can use them to store links, buttons, icons, shortcodes from other plugins, etc. You should add the full HTML code or shortcode to the custom field so that the product table can display it correctly. If you’re using shortcodes, you will need to set shortcodes to true.

You can add custom fields to your table using the format cf:<field name>. If you are using Advanced Custom Fields, the field name can be found under the “Field Name” column in the Custom Fields menu.

Here’s an example adding two custom fields – my_field1 and my_field2:

[posts_table columns="title,content,cf:my_field1,cf:my_field2"]

WordPress table plugin with custom field columns

Table with custom field columns for Publisher, Rating, Series, Date & Buy button

Custom fields created using the Toolset Types plugin

If you’re using Toolset Types to create your custom fields, then you need slightly different syntax to display them in the table.

Toolset adds wpcf- to the start of the custom field name, so if you create a custom field called ‘link’ (for example) then the correct syntax will be wpcf-link. This means that if you want to create a table with columns for name and a custom field called ‘link’ then you would need to add it as follows:
[posts_table columns="name,cf:wpcf-link"]

Custom taxonomy columns

For taxonomies (other than post categories and tags), use the format tax:<taxonomy slug>. So, for example, to display for a custom taxonomy with the slug document_type, you would use:

[posts_table columns="title,content,tax:document_type"]

You can find the taxonomy slug by going to the WordPress admin and finding the main page which lists those taxonomies. For example, WooCommerce product categories are edited under the Products -> Categories menu. On that page, the URL at the top of the screen shows “…edit-tags.php?taxonomy=product_cat….”. The ‘product_cat’ bit after the equals is the taxonomy slug you need to use.

Choosing your own column headings

You can set custom column headings by adding a : (colon) after the column name. You can do this for as many columns as you like. If you don’t set a custom heading, the default one will be used. For example, the default heading for the post title is “Title”, but if you wanted the heading “My Heading” instead, you would use:

[posts_table columns="title:My Heading,date,author,content"]

WordPress Table Custom Column Headings

Custom column headings for Title, Image, Date, Categories & Tags

Here’s a more complex example where we’re displaying a custom post type “property”, and we want to set the title column heading to “Property Description”, the date column to “Added On”, a custom taxonomy to “Type” and a custom field to “Sale Price (£)”:

[posts_table post_type=property columns="title:Property Description,date:Added On,tax:listing_cat:Type,cf:valuation:Sale Price (£)"]

Note: In the above example, the taxonomy and custom field columns now have two colons – one to define the taxonomy (or custom field) name, and the other to set the column heading. This is perfectly fine as long as you use the correct syntax. For these column types, everything after the second colon will be used as the custom heading, including the space between the 2 words.

Removing a column heading

If you would like to remove the column heading completely use the keyword blank after the colon. For example:[posts_table columns="title:blank,content,categories"]

WordPress table plugin hide column headings

Table with all column headings set to “blank”. Only the sort arrows are visible

Was this article helpful?

Related Articles