Create your first block

How to manage forms

Enabling the dynamic blocks

First, you need to enable the dynamic blocks feature to use it.

Go to the Settings page and find the "Content settings" section, enable dynamic blocks, and you're good to go.

Create your first dynamic block

To create a new template, navigate to the blocks list and click on the Create Block button.

A 5-step form will open:

Step 1. General

Here you can choose the basic block settings, such as name, icon, keywords, and the block icon.

Finally, you can enable the block for one or more post types.

Step 2. Supports

Declare block support for certain features, like text alignment or typography.

For more info, refer to the official documentation.

Step 3. Controls

In some cases, you may want extra controls.

You can add all the custom controls you need, like text, checkboxes, or select fields.

Step 4. Callback

This is the HTML body of the block. The TWIG syntax is fully supported.

You can use ACPT fields in your blocks in several ways.

Using shortcodes

If you want to display a shortcode, do the following:

{{ do_shortcode("[acpt box='meta' field='audio']")|raw }}

Be aware to use the raw filter to properly render the field.

Using raw data

Instead, if you use acpt_meta_audio as a variable, this internally calls the get_acpt_field function, returning the field raw data as a string, an object, or an array.

For example, if you have a gallery field, you can do something like this:

<ul>
    {% for img in acpt_meta_gallery %}
        <li><img src="{{ img }}" /></li>
    {% endfor %}
</ul>

Step 5. Style

Apply your custom CSS rules to the block.

Last updated