The Shortcode [table id=N /]

The Shortcode [table id=N /] is used to display a table in a post, on a page, or in a text-widget. It can either be entered manually or automatically using the “Table” button in the editor toolbar when editing a post or page.

The Shortcode can have the following parameters. All parameters can simply by added to the Shortcode (in arbitrary order), e.g.

[table id=1 alternating_row_colors=false column_widths="40px|50px|30px|40px" /]

If a parameter is added, it overwrites the corresponding Table Option from the “Edit” screen of that table!

For most use cases, it is recommended to change the setting in question by using the corresponding checkbox on the “Edit” screen of the table.

id (string) (required)
The ID of the table to show (can be seen on the “All Tables” or the “Edit” screen).
column_widths (string) (optional)

string with column widths, separated by the |-symbol (pipe)



alternating_row_colors (boolean) (optional)
whether the table shall get alternating row colors (“zebra striping”) (see the CSS classes odd and even)
row_hover (boolean) (optional)
whether table rows shall be highlighted with a different background color, if the mouse hovers over them
table_head (boolean) (optional)
whether the first row will get <th> HTML tags inside a <thead> HTML tag
first_column_th (boolean) (optional)
whether the first column will get <th> HTML tags (there is no checkbox for this on the “Edit” screen!)
table_foot (boolean) (optional)
whether the last row will use <th> HTML tags inside a <tfoot> HTML tag
print_name (boolean) (optional)
whether the name of the table shall be printed above/below the table
print_name_position (string) (optional)
position for printing the table name: can be “above” or “below”
print_description (boolean) (optional)
whether the description of the table shall be printed above/below the table
print_description_position (string) (optional)
position for printing the table description: can be “above” or “below”
use_datatables (boolean) (optional)
whether the DataTables JavaScript library (a jQuery plugin) shall be used with this table (will only work, if the first row gets <th> HTML tags (either by the setting on the table’s “Edit” screen or by the Shortcode parameter)
datatables_sort, datatables_paginate, datatables_lengthchange, datatables_filter, datatables_info (boolean) (optional)
whether the corresponding feature of the DataTables JS library shall be activated for this table (more information in the DataTables section or on the DataTables website)

show_rows, hide_rows, show_columns, hide_columns (string) (optional)

These parameters can be used to overwrite visibility settings in the backend on a per-Shortcode basis.

[table id=2 hide_columns="1,2,3" show_rows="4,5,6" /]

will hide the first three columns and show rows 4, 5 and 6, regardless on what visibility setting they have in the backend. Instead of adding each row or column number manually, there’s also a parameter value “all” that will affect all rows/columns. They can also be used at the same time, if needed:

hide_columns="3,4,5" show_columns="8,9"
cellspacing, cellpadding, border (integer) (optional)

Corresponds to the parameters in

<table cellspacing="0" cellpadding="0" border="0"><tr><td>...</td></tr></table>

By default those are not set as the setting can be better influenced with CSS. In some rare cases they might necessary though.