sage-acf-wp-blocks
sage-acf-wp-blocks copied to clipboard
Render ACF Block inside a page template
Hello,
Thank you for the wonderful plugin.
Is there way to render an ACF Block you've created in a given page template (in my case a post template)?
I have developed a specific layout block that I want to be preloaded for all posts that have template = "three-col-layout".
Please advise if this is possible.
Hi @ushka since the Gutenberg editor is available inside the content you could simply display the_content.
If you would like to use some sort of block template (pre-defined block layout) you could create re-usable blocks. I think that is your best option since you want this block to be editable. Else you could simply create a custom ACF section outside of the editor.
@ushka I was able to render a block in my template with @include('blocks.my-custom-block') without any issues. I then cloned the block fields to that page’s field group in ACF.
This is actually the main reason I decided to use this plugin. Thanks to @MWDelaney for the great work!
@tedw @luukskeur - I was able to do the same by assigning: views/footer-block.blade.php and assigning as a theme option then inserting @include('blocks.footer-block') in layouts/app.blade.php
All works well, the fields output. However - the block ID appears as empty when rendered
data-{{ $block['id'] }} // block['id'] not putting ID
Is this possible or any theme configurations needed to get the ID to output?