1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. Posts Table Pro Shortcode Options
  5. Mobile visibility & responsive options

Mobile visibility & responsive options

Posts Table Pro comes with several options for controlling how the responsive tables behave on different screen sizes, for example mobiles and tablets.

Wrap

The wrap option tells the table whether to wrap long content onto multiple lines, or to keep everything on a single line and hide the rest. The default is true which means longer content will “wrap” onto extra lines as needed. If you set this to false it will ensure that each row is exactly one line high:

Example: [posts_table columns="title,author,categories" wrap="false"]

Priorities

WordPress plugin hide table columns on mobileThe priorities option is only relevant when displaying the table on smaller screen sizes (mobiles, tablets, etc) or when you have a lot of columns in your table and the plugin can’t fit everything in. When the screen size gets too small, the plugin will collapse certain columns down so they are no longer visible, and a “+” icon will appear at the left-side of each row. Clicking this icon will expand the row to show its full contents.

So the priorities option is used to determine the order in which columns are “collapsed” on smaller screens. Some default priorities are used, but if you wish to override these you can use this option. The lower the number, the higher priority that column has. So a column with a priority of “1” would have the highest priority and be collapsed last.

If you had a table with three columns – title, author, and categories, and you wanted to make title the most important, categories second most, and author least important you would use the following: [posts_table columns="title,author,categories" priorities="1,3,2"]

Column breakpoints

The column_breakpoints option gives you fine-grained control over the breakpoints for each column when viewed at smaller screen sizes.

By default, Posts Table Pro will show or hide columns on smaller screens based on the priorities option described above (or the default priorities if none are set). If you wish to set more specific breakpoints, you can set one of the following options for each column: desktop, tablet, mobile, all, none or default. For example, setting a breakpoint of tablet for a column means it will display on tablet devices, but not on mobiles or desktop screens.

The all option means the column will always be visible, regardless of screen size. The none option means it will not be shown in the table, but the column will still show in the child row (or modal) when expanded. The default option will let the plugin decide when it is hidden (using the priorities option if set).

You should set one option for each column in the table, for example:
[posts_table columns="title,content,tags,date" column_breakpoints="default,desktop,mobile,all"]

Responsive control

When the table can’t fit all the data within the space available (for example, on mobile devices) a “plus” icon appears to the left of each row to allow the user to show or expand the full content. The responsive_control option sets whether that “+” icon control is displayed inside the first column (responsive_control="inline") or within its own separate column (responsive_control="column"). Defaults to inline.

Responsive display

The responsive_display option determines how the “child rows” are displayed when viewing the table on smaller screen sizes (or when there is too much data to fit in the table). By default, the extra columns are displayed inside a child row which can be shown by clicking the “+” icon at the start of each row. You can also choose from the following options:

  • child_row – the default option. Extra data will be displayed in a hidden child row.
  • child_row_visible – Extra data is displayed in a child row which is expanded automatically when the table is first viewed.
  • modal – Extra data is displayed in a modal window when the “+” icon is clicked.

Example: [pposts_table columns="title,content,date,status,author" responsive_display="modal"]

Was this article helpful?

Related Articles