Appearance
Shortcode / Computed Value or HTML in WP Post / Woocommerce Table
The Shortcode / Computed Value or HTML field type builds each cell from a template. The template can mix HTML, placeholders for the row's post data and any WordPress shortcode. Use it for buttons, custom links, formatted values or output from other plugins. It works in WP Posts and WooCommerce tables (Pro), and in a simpler form in FluentCart tables (Free).
Add the column
- Open your table and go to the Table Rows tab. If you don't have a table yet, create one from Create Table › WP Posts/CPTs (or WooCommerce products).
- On the banner, click Edit query (WP Posts tables) or Source settings (WooCommerce and FluentCart tables), then open Add new column.
- Enter a Column name, such as "Buy Now", and a Column key.
- Under Dynamic post data (or Dynamic column data), set Field type to Shortcode / Computed Value or HTML.
- Write your template in Field value. The instructions under the field list the placeholders.
- Click Add column.
Placeholders
| Placeholder | Replaced with |
|---|---|
{post.ID} | The post ID |
{post.post_title} | The post title |
{post.permalink} | The post's URL |
{post.featured_image_url} | The URL of the featured image |
{post.FIELD} | Any other post field, such as {post.post_date} or {post.post_excerpt} |
{postmeta.META_KEY} | A custom field (post meta) value |
{acf.FIELD_NAME} | An ACF field value (when ACF is active) |
Placeholders also work inside shortcode parameters: [yourshortcode YourParam="{post.ID}"].
Placeholder values are cleaned before they go into the template. URLs ({post.permalink} and {post.featured_image_url}) are made safe as URLs, other values keep basic HTML and lose scripts, and values placed inside a shortcode parameter are escaped for attributes. A placeholder with no value, such as a missing custom field, leaves an empty spot. After the placeholders are filled, WordPress runs every shortcode in the result.
On a WooCommerce reviews table, the placeholders read the product that was reviewed.
Examples
A link to the post:
html
<a href="{post.permalink}">Read {post.post_title}</a>A thumbnail from the featured image:
html
<img src="{post.featured_image_url}" alt="{post.post_title}" width="80">A WooCommerce add-to-cart button, using the WooCommerce add_to_cart shortcode:
[add_to_cart id="{post.ID}" show_price="false"]A value from a custom field with a label:
html
<strong>Location:</strong> {postmeta.event_location}Click Preview in the editor header to see the result.
FluentCart tables
FluentCart tables support {post.FIELD}, {post.permalink} and {postmeta.META_KEY}, with one limit: a placeholder only works when it is the whole field value, for example just {postmeta.color}. A template that mixes text or HTML with placeholders isn't filled in. HTML and shortcodes without placeholders work as usual.
Good to know
- You can find ready-made shortcodes in the documentation of WooCommerce and other plugins.
- A product table already has an Add To Cart button in its Buy column. Use a shortcode column only when you want a second button or different markup.
- To change the template later, open the column header › Column settings.
For every other column type, see the Dynamic columns reference.