Enable option selection in Bricks template in gutenberg

I have a Bricks template that gets an ACF repeater from the current post. It’s fine for the CPT post pages themselves, shows the repeater perfectly. It’s for ‘resources’ (docs/links etc.)

I’d like my client to be able to add a block to the gutenberg editor for regular posts, select a ‘resource (cpt post)’ from a drop-down, and for the block to get its data from the resource post. So a regular post could pull in a CPT ‘resource’ post and show it.

It would be great to use the Bricks shortcode, such as [my-template post=“1”] - but this isn’t possible.

I am a rudimentary coder at best.
I’d really appreciate ideas on the best approach.

Hi

Why not using an acf relationship field?

My use case: I have acf galleries. In the post, I chose the relevant acf gallery via the acf relationship field.

Cheers

Patric

1 Like

Thanks @Patric . Are you able to put this gallery anywhere in the post, or is it always appended/prepended to the post content?

You can put the content of the acf relationship field anywhere you like.

The acf relationship field does nothing else than „linking“ the „external“ content to the post so that you can get its information inside the post.

I quote

„ The Relationship (including the bidirectional implementation) and the Repeater field types are also available inside the Query Loop builder so you could loop through the output of these fields while rendering the sub-fields as dynamic data.“

Also nice:

1 Like

Marvellous. I have a very limited understanding of the relationship fields. Need to have a play. This looks like it’ll do the job. Many thanks.

The acf relationship is very powerful. With Bricks, without coding, you can not only show the post and all the resources that were added into it, but you can also show a resource and all the posts that have this resource added into it.

They call this bi-directional and all you need to do is select the acf field and the meta key in the query loop. Bricks makes it so easy.

Cheers

Patric