Get ACF Block fields values in section template

I would like to ask you for very specific integration between ACF Block fields, ACF Blocks and Bricks section template Shortcodes.

Usually, I create my ACF Block template manually with HTML + CSS. However, I would love to create my Blocks in Bricks and then display Block ACF fields data in Bricks template (for example section template).

How can I query the block fields? For each block, I use this structure:

  1. block.json - register block css and template and name, category, capabilities etc.
  2. block.php - get ACF block fields and save their values to the $data variable, get block ID and create CSS classes
  3. template.php - the HTML structure of block with echoes of data in $data variable
  4. block.css - CSS

I can add the Bricks template shortcode into the template.php but I am not able to echo any $data[‘acf_block_field’] in the Bricks template.

How can I “parse” the blocks $data to the Bricks template? Is it possible? Do you have some idea how to do that?

Still zero ideas? I tried to load the $data variable inside the bricks template published by shortcode in template.php with no luck :frowning:

With the new patterns in WordPress 6.4, I also started exploring this exact same thing with ACF blocks+Bricks templates and I’m also stuck with how to echo the ACF block fields within the Bricks template.

1 Like

I guess this is the perfect solution to this. It says it can work with ACF blocks and ACF fields. I hope to give it a try soon.

https://gutenbricks.com/

The reason I would want something like this is to allow clients to build within the default editor using the same tools we use for Bricks and prevent the use of other block plugins. Saves me resources on my server and avoid a ton of unnessesary plugins while giving the client enough room for their own customization without wrecking the site.