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

Posts table sort options

Posts Table Pro comes with 2 options for sorting the table when it first loads. Once the table has loaded, users can click on a column heading to sort by that column.

Sort by

The sort_by option sets which column should be used for sorting the table by when it is first displayed. Defaults to date which is the date the post or page was published.

You can sort by any column present in the table, or by any of the following keywords (whether or not they are included in your table):

  • id – sort by post ID
  • title – sort by post title
  • menu_order – sort by the ‘order’ option
  • date – sort by the date of the post/page (i.e the publish date)
  • name – sort by post ‘slug’
  • modified – sort by last modified date
  • author – sort by author name
  • comment_count – sort by number of comments
  • type – sort by post type
  • rand – random order


Sort using keyword:  [posts_table columns="title,content" post_type="page" sort_by="menu_order"]

Sort using column in table:  [posts_table columns="image,title,content,author" sort_by="content"]

Sort order

The direction to use for sorting by when the table is first displayed. Can be either asc for ascending order or desc for descending order. Defaults to desc for date-based sorting, and asc for everything else, but you can override using this option.


[posts_table columns="title,content" sort_by="date" sort_order="asc"]

Can I sort by multiple columns?

No, this is not currently possible. The table can only be sorted by a single column.

Was this article helpful?

Related Articles