Support

Account

Home Forums Gutenberg Working with CPT/ACF fields in Gutenberg with ACF Blocks

Solving

Working with CPT/ACF fields in Gutenberg with ACF Blocks

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

    Any help would be GREATLY appreciated!!

    -Tom

  • 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! 🙁

  • Has the first question above ever been answered. How do we use the ACF Gutenberg block feature to display custom fields that are tied to Custom Post Types?

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Working with CPT/ACF fields in Gutenberg with ACF Blocks’ is closed to new replies.