Home Forums ACF PRO Get the data from a custom ACF Block and print to another page


Get the data from a custom ACF Block and print to another page

  • Hello Developers.

    Ι have a custom ACF Block which called services. The content of this block is a title and a repeated field. I want to display this content on two different pages.

    In my case, I want to get the print values of this ACF Block from one page and I want to pass on the second page.

    I read the documentation and I find

    If anybody has a solution to this I’d be very grateful. 🙂

  • This is my code. 2276 is the block ID. When I make the changes on the block from the first page (homepage), then the changes are not passed to the second page (services). I wonder what I am doing wrong.

        $services_header_title = get_field('services_header_title', $block_ID);
       <div class="col-lg-12">
           <h2><?php echo $services_header_title; ?></h2>
        <?php if( have_rows('services') ): ?>
         <?php while( have_rows('services') ): the_row();
              // Get sub field values.
              $service_title = get_sub_field('service_title', $block_ID);
              $service_content = get_sub_field('service_content', $block_ID);
             <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                <h3><?php echo $service_title; ?></h3>
                <p><?php echo $service_content; ?></p>
       <?php endwhile; ?>
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 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.