Built my first ACF Block in Gutenberg and see a lot of potential! I am struggling to understand how to work with a Custom Post Type that has ACF fields in the GB editor. I am able to see the CPT in Gutenberg and the related ACF fields in the right site panel.
First use case, I want to reference the parent ACF fields from an ACF block. For instance if the CPT ACF field for color is red then I would show the block in red. How do I get the parent ACF field my from my block template?
Second use case, in the CPT in the GB editor if the use checks the “Show CTA button” then I would like to generate the HTML button code in the page (or CPT in this case). In other words is is possible to have a mix of generated markup as well as blocks?
I think I figured out the second use case myself. I thought Gutenberg handled the CPT rendering differently but apparently I just needed to create a single-CPTNAME.php file in my child theme and edit that. I assume that is still the best practice?
The first use case, accessing the parent CPT ACF fields from a block still have me stumped! 🙁
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users