Skip to content

ACF Block Helper

Mattias edited this page Sep 9, 2021 · 3 revisions

add()

The add function registers an array of acf blocks.

add(array $args)

Parameters

  • $args (array) (Required) Accepts all ACF Block parameters.
    • name (string) (Requierd)
    • title (string) (Requierd)
    • description (string) (Optional)
    • render_callback (string) (Optional) Default: Calls to the private render() function and looks for {$name}.php in /templates/parts/acf-blocks/.

Example

$arr = [
    [
        'name'        => 'example',
        'title'       => __('Example', 'iroh'),
        'description' => __('Example description', 'iroh'),
        'mode'        => 'edit',
    ],
];
acfblock()->add($arr);
Clone this wiki locally