1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. Posts Table Pro Features
  5. Displaying dates in Posts Table Pro

Displaying dates in Posts Table Pro

Posts Table Pro includes several options for how dates are displayed and formatted in your tables.

Date format

The date_format option tells the table how to format the date column in the table. It only works if your table includes a date column. If you don’t set this option, the default format in your WordPress settings will be used (see Date Format under the Settings -> General menu).

You can set the date format to any valid date/time format string. For example: F j, Y will format the dates in this format: “August 24, 2016”. See the WordPress Codex for more information.

Example: [posts_table columns="title,date" date_format="F j, Y"]

Date columns

The date_columns option is used to specify which columns in your table should be treated as dates. This is useful if you have custom fields or taxonomies which represent date values, and you want enable sorting for these columns or change the format. This option should contain one or more columns (as a comma-separated list) using the same syntax as the columns option. For example:

[posts_table columns="image,title,cf:my_date,tax:my_custom_tax" date_columns="cf:my_date,tax:my_custom_tax"]

You don’t need to include the date column here, as this is always treated as a date. This is just for additional date columns such as custom fields.

Setting this option will also allow you to set the date format for these columns using date_format option.

Was this article helpful?

Related Articles