The Shortcode
[table-info id=N field=<field-name> /]
Code language: JSON / JSON with Comments (json)
can be used to display table meta data in a post, page, or text widget.
The Shortcode has three parameters:
- id (string) (required)
- The ID of the table that has the Custom Data Field
- field (string) (required)
- The name of a meta field (see below)
- format
- only possible value:
raw
. Only applies to the default fieldlast_modified
and will return the raw datetime format instead of the pretty string.
Possible values for field are:
- name
- The name of the table with ID id
- description
- The description of the table with ID id
- last_modified
- The time of the last modification of the table with ID id, if the
format
parameter is set toraw
, a datetime string will be returned, otherwise a pretty string. The formathuman
can be used to show a text like “5 hours ago”, the format valuesdate
andtime
show just the date or time of the last modification, respectively. - last_editor
- The author who last modified the table with ID id
Example of three Shortcodes in action (i.e. in a post or on a page near a table):
The table [table-info id=2 field=name /] was last modified at [table-info id=2 field=last_modified format=raw /] by [table-info id=2 field=last_editor /].
Code language: HTML, XML (xml)
will produce something similar to
The table Demo Table was last modified at 2022-12-20 15:20:21 by TobiasBg.
Code language: HTML, XML (xml)
There’s a also a Template Tag Function for this Shortcode available:
<?php tablepress_table_info( 'id=1&field=name' ); ?>
Code language: PHP (php)
It works exactly like the Template Tag Function, with the parameters from this section.