Home Forums Gutenberg Parsing ACF Gutenberg block from another page


Parsing ACF Gutenberg block from another page

  • Normally, in my footer, Iā€™d pull ACF fields from the Contact page. That post ID is 11. I decided to use ACF Gutenberg blocks instead. The block file is called business-info.blade.php. Therefore, business-info is my block name. Is it possible to parse that block from my Contact page into the footer?

    I thought this might work, but it’s wrong:

    if ( function_exists( 'get_field' ) ) {
    	$pid = get_post( 11 );
    	if ( has_blocks( $pid_content ) ) {
    		$blocks = parse_blocks( $pid->post_content );
    		foreach ( $blocks as $block ) {
          // field name from my block is called, name
          $name = $block['attrs']['data']['name'];
    			if ( $block['blockName'] === 'acf/business-info' ) {
            echo $name;
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.