WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am loving the ACF (Advanced Custom Fields) plugin repeater field but I have two pages in my WordPress site that have sections which share exactly the same data.

Obviously one of the key aspects of a CMS is that when such a situation as the one above arises, the client should only have to update that shared data in one place.

I'm wondering how I can do this though? I have found the below:

$include = get_pages('include=120' );
$content = apply_filters('the_content' ,$include[0]->post_content);
echo $content;

This works for 'the_content' but I am not sure how to substitute it for my repeater field data which looks like this:


if( get_field('treatments' ) ): ?>

$i = 0;
while( has_sub_field('treatments' ) ): 

<div class="treatments" id="treatment-<?php echo $i; ?>">

<img src="<?php the_sub_field('image' ); ?>"  />
<?php the_sub_field('description' ); ?>
<a href="<?php the_sub_field('link' ); ?>">Read More ></a>

</div> <!-- treatments -->

<?php endwhile; ?>

<?php endif; ?>
share|improve this question
up vote 0 down vote accepted

The ACF functions accept a second argument which is the ID of the page you wish to retrieve the fields from. See the code examples in documentation.

$page_id = 120;
if( get_field( 'treatments', $page_id ) ):

    while( has_sub_field( 'treatments', $page_id ) ):

        // the_sub_field and get_sub_field don't need a post id parameter
        the_sub_field('image' );
        the_sub_field('description' );


share|improve this answer
Thanks Milo. Awesome. – Johnny Feb 25 '13 at 19:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.