Shortcodes

How to use shortcodes

Available shortcodes

ACPT exposes different shortcodes to display meta fields.

[acpt]

Display custom post-type meta fields.

Usage example:

[acpt box='box_name' field='field_name']

It's possible to specify the post ID:

[acpt pid="234" box='box_name' field='field_name']

If not provided, the global $post object will be used to get it.

[acpt_tax]

Display taxonomy meta fields.

Usage example:

[acpt_tax box='box_name' field='field_name']

It's possible to specify the term ID:

[acpt_tax tid="234" box='box_name' field='field_name']

If no tid or terms are provided, the get_queried_object() is used to try to fetch the term ID.

[acpt_option]

Display an option page meta field.

Usage example:

acpt_option page="your-page-slug" box='box_name' field='field_name']

Where page is the page's slug.

[acpt_user]

Display user meta fields.

Usage example:

[acpt_user box='box_name' field='field_name']

It's possible to specify the user ID:

[acpt_user uid="234" box='box_name' field='field_name']

If uid is not provided, the user of logged-in user is used.

[acpt_media]

Display attachment meta fields.

Usage example:

[acpt_media pid="1203" box='box_name' field='field_name']

In this case, it's mandatory to specify the attachment ID.

Other arguments

Here is the complete allowed arguments list:

ArgumentIs requiredDescription

box

Required

The box name

field

Required

The field name

width

The width (in px or %) of images (only for Image and Gallery fields)

height

The height (in px or %) of images (only for Image and Gallery fields)

target

The target of (only for Link field)

dateFormat

The date format (only for Date field)

timeFormat

The time format (only for Datetime and time fields)

elements

The number of elements per row (only for Gallery field)

parent

The parent element (only for Repeater nested fields)

index

The numeric index of the nested field (only for Repeater field)

blockName

The parent block name

blockIndex

The numeric index of the nested field (only for Flexible field)

render

Render the (only for Checkbox, Radio, Select, and Select Multi fields), or (only for Email and Phone fields)

list

How to (only for Checkbox, Select Multi, and List fields)

separator

Strings separator (only for Checkbox, Select Multi, and List fields)

classes

Additional CSS classes

Example: date field

Suppose you want to use a custom date format address.

Use the following syntax:

[acpt box='box_name' field='date_field' dateFormat="d/m/Y"]

Example: email field

Suppose you have an email field and want to display it as mailto link.

Do the following:

[acpt_tax box='box_name' field='field_name' render="link"]

Instead, if you want to display just the email as a text string:

[acpt_tax box='box_name' field='field_name' render="text"]

Last updated