Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render ACF Block inside a page template #25

Open
ushka opened this issue Aug 20, 2019 · 3 comments
Open

Render ACF Block inside a page template #25

ushka opened this issue Aug 20, 2019 · 3 comments

Comments

@ushka
Copy link

ushka commented Aug 20, 2019

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.

@luukskeur
Copy link
Contributor

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.

@tedw
Copy link

tedw commented Nov 15, 2019

@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!

@markifornia
Copy link

markifornia commented Dec 4, 2022

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants