Site logo

Archived topic

"Block - Hook" with Dynamic Data X ACF

5 replies · Started by webintas on March 22, 2023

Viewing posts 1–6 of 6

Hi there,

I am trying to get used to using your "Block - Hook" element. I want to use it for a sidebar widget for a custom post type where some content is static and some content is dynamic from ACF.

The static content is easy. Also the SIMPLE dynamic data (e.g. a text line) but I am running into issues when trying to output data from ACF where the data format is an array. Also text area where <br> or <p> tags are automatically added through the ACF settings is not working (no line breaks is added).

So how could I handle this? Is it possible to write some PHP in functions.php where I output the more advanced field and then hook into the "Block - Hook" element.

I hope the request is clear. I am looking forward to hearing from you.

Best Regards,
Peter B. Stidsen

Hi there,

you would need to create an ACF Shortcode to return content from an array.
You can add shortcodes inside a GenerateBlocks Headline Block if you want to use its styling controls.

We will be added ACF array and other feature support to a future GenerateBlocks Pro release.

Let me know if you need any more details.

Hi David,

So how do I create such shortcode?

If its a simple text then ACF comes with some baked in shortcodes:

https://www.advancedcustomfields.com/resources/shortcode/

If its more advanced then it requires some PHP.
And that will vary depending on what the field does.

So what does the field display ? eg. a list of text, or images ....

I would recommend reaching out to ACF's support for how to generate the shortcode.

This archived topic is closed to new replies.