This feature is available from Dynamic Shortcodes version 1.7.0 or higher.
The APCT Dynamic Shortcode allows you to access and display data from the ACPT (Advanced Custom Post Types) plugin within WordPress.
It can retrieve single fields, loop through repeater or flexible content fields, and even access nested structures.
This shortcode supports reading from posts, users, terms, or option pages.
It also automatically formats certain ACPT field types (such as Date, Address, or Currency).
Syntax
{acpt:box_name field_name}Variants:
acpt– returns a single field.acpt-loop– loops over repeater or flexible content fields and renders the content inside.acpt-row– returns info about the current loop row or block name.
Key Arguments
Keyarg | Description | Notes |
| Defines the post, user, or term ID. | Used with |
| Name of the ACPT box (required for | Always a string. |
| Enables ACPT formatting for supported field types. | Defaults to |
| Reads fields from a post. | Can be combined with |
| Reads fields from a user profile. | Optionally with |
| Reads fields from a taxonomy term. | Optionally with |
| Reads fields from an ACPT options page. | Requires Power Shortcode privileges. |
| Defines a separator string for | Optional. |
Examples
1. Retrieve a field from the current post
{acpt:my_box my_field}Returns the value of the field my_field inside the box my_box for the current post.
2. Retrieve a field from another post
{acpt:my_box my_field@id=42}Fetches the my_field value from the ACPT box my_box on the post with ID 42.
3. Loop through a repeater field
{acpt-loop:my_box my_repeater [{acpt:sub_field}] @sep=', ' }Iterates through each row of the repeater field my_repeater in box my_box, printing the value of sub_field for every row, separated by a comma.
4. Loop through a flexible content field
{acpt-loop:my_box my_flexible
[
{switch:{acpt-row:block}
text {acpt:my_field}
image [<img src="{media:url @ID={acpt:my-image}}" />]
}
]
}Loops over the flexible content field my_flexible and outputs the blocks text and image.
5. Retrieve user or option page fields
{acpt:user_box my_field@user id=5}
{acpt:options_box title@option=general}The first shortcode returns the value of
my_fieldin theuser_boxbox for the user with ID 5.The second retrieves the
titlefield from the ACPT options pagegeneral. (Requires Power Shortcode privileges).
Access to Raw Data
By using the keyarg format=false, you can receive the original field format without automatic formatting being applied.
For example, in the case of an address field, without format=false, you directly obtain the formatted address, while with format=false, you receive the complete array as stored by ACPT in the database — containing the address and location information.
{acpt:box-name my-field @ format=false}
You can then access individual elements of the array using array syntax:
{acpt:box-name my-field || address @ format=false}to access the address{acpt:box-name my-field || lat @ format=false}for the latitude{acpt:box-name my-field || lng @ format=false}for the longitude
