Shortcodes
How to use shortcodes
Available shortcodes
ACPT exposes different shortcodes to display meta fields.
[acpt]
Display custom post-type meta fields.
Usage example:
It's possible to specify the post ID:
If not provided, the global $post
object will be used to get it.
[acpt_tax]
Display taxonomy meta fields.
Usage example:
It's possible to specify the term ID:
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:
Where page
is the page's slug.
[acpt_user]
Display user meta fields.
Usage example:
It's possible to specify the user ID:
If uid
is not provided, the user of logged-in user is used.
[acpt_media]
Display attachment meta fields.
Usage example:
In this case, it's mandatory to specify the attachment ID.
Other arguments
Here is the complete allowed arguments list:
Argument | Is required | Description |
---|---|---|
| Required | The box name |
| Required | The field name |
| The width (in px or %) of images (only for Image and Gallery fields) | |
| The height (in px or %) of images (only for Image and Gallery fields) | |
| The target of (only for Link field) | |
| The date format (only for Date field) | |
| The time format (only for Datetime and time fields) | |
| The number of elements per row (only for Gallery field) | |
| The parent element (only for Repeater nested fields) | |
| The numeric index of the nested field (only for Repeater field) | |
| The parent block name | |
| The numeric index of the nested field (only for Flexible field) | |
| Render the (only for Checkbox, Radio, Select, and Select Multi fields), or (only for Email and Phone fields) | |
| How to (only for Checkbox, Select Multi, and List fields) | |
| Strings separator (only for Checkbox, Select Multi, and List fields) | |
| Additional CSS classes |
Example: date field
Suppose you want to use a custom date format address.
Use the following syntax:
Example: email field
Suppose you have an email field and want to display it as mailto
link.
Do the following:
Instead, if you want to display just the email as a text string:
Last updated