Home Forums Gutenberg ACF Blocks – Need stable id Reply To: ACF Blocks – Need stable id

  • Slightly modified

        "$schema": "",
        "apiVersion": 2,
        "name": "acf/clb-custom-info-card",
        "title": "Info Card",
        "description": "A custom info card block.",
        "style": [ "clb_custom_info_card.css", "clb-custom-info-card-style" ],
        "category": "common",
        "icon": "admin-comments",
        "keywords": ["testimonial", "quote"],
        "acf": {
            "mode": "preview",
            "renderTemplate": "clb_custom_info_card.php"
        "align": "full"

    Save it as card-block.json and place in theme subfolder /acf-blocks/ – or where you like. Just adjust paths.

    Filename can be changed, but must end with -blocks.json (discovered this after lots of debuging)

    Style value can break the loading if the file can’t be found. It should be relative to the card-block.json

    In your functions.php you can load it with

        get_template_directory() . '/acf-blocks/card-block.json'

    I placed it in a subfolder to the theme /acf-blocks/ with clb_custom_info_card.cssin the same folder.

    You can declare expected attributes with a static default value by adding this node in the json.

    "attributes": {
        "my_custom_attribute": {
            "type": "string",
            "default": "a_default_value"