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:

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