Additional options

Learn how to add options for specific fields

ACPT allows the user to specify additional options for certain field types.

Date fields

Specifying the desired date format is possible for every date field.

Example:

{acpt_name_of_the_field:d/m/Y}

The current WordPress date and time formats are used if the date format is not specified.

Currency, Length, and Weight fields

These arguments are supported, please follow this order:

  • format - the string format (default: full, allowed: full | symbol | value)

  • decimal separator - the decimal separator (default: .)

  • thousands separator - the thousands separator (default: ,)

  • position - the unit of measure position (default: after, allowed: after | before)

Suppose you want to render 1600000USD.

Here are some examples:

{acpt_field_currency:symbol}            // 1,600,000.00 USD
{acpt_field_currency:symbol}            // 1,600,000.00 $
{acpt_field_currency:value}             // 1,600,000.00
{acpt_field_currency:symbol:.:,:before} // $ 1.600.000.00

Select Multi and Checkbox fields

For Select Multi and Checkbox fields, is possible to specify how to render them.

1. Render as list

The default rendering is as HTML <ul>. It is possible to specify the CSS classes to <ul> element:

{acpt_field_list:ul:fancy-class}

The element will be rendered as:

<ul class="fancy-class">
    <li>foo</li>
    <li>bar</li>
    <li>baz</li>
</ul>

If you want to display the list as an ordered list <ol>:

{acpt_field_list:ol,fancy-class}

The element will be rendered as:

<ol class="fancy-class">
    <li>foo</li>
    <li>bar</li>
    <li>baz</li>
</ol>

2. Render as string

You can display these fields as strings, specifying also the string separator:

{acpt_field_list:string:-}

To display a field as strings separated by -, something like that:

foo-bar-baz

It is possible to display a gallery element by specifying its index (count starts from 0).

Example:

{acpt_gallery_field:1}

This code will render only the second image of the gallery.

Email, Phone, and URL fields

Those fields can also be rendered as simple strings and not links using the string attribute.

Example:

{acpt_field_email:string}

Text truncate

For every textual field, it is possible to truncate the text.

Example:

{acpt_text_field:30}

Last updated