ACF Template Builder

Adding shortcode attributes

You can add your custom attributes to be handled by the ACF fields. For this you will need to add the attribute to the field-type that handles the output. When that's done, you can add or replace the output-filters to use that attributes value.

Adding the attribute to the field-type

Add the attribute my merging it with the existing attributes that are used by a specific field-type:

[pastacode lang="php" path_id="a620189bce152cb92af6e2b9ccb412b2" highlight="" lines="" provider="gist"/]

Using the attribute

When the field-type has the custom attributes applied, it will be able to pass those attributes to the output-filters. You can now write your callbacks to use those attributes.

The following example will add a colored border around a google_map field-type, whenever a color-attribute has been provided and is set.

[pastacode lang="php" path_id="fece16228feece8646cd4d7298d4160f/caed0a2df174fb94ad9dd063380e9f0483316af4" provider="gist" /]