Support » Plugin: Advanced Custom Fields » Getting values from parent page

  • Resolved rikardo85



    I am trying to get the values from a parent page which is using the repeater functionality.

    I would like to display the values on the child pages and possibly grandchild pages.

    Below is the code I am using to display the values on the parent page:

      <div class="historyNav">
    	 $rows = get_field('history');
    	     foreach($rows as $row)
    		{ ?>
                       <a href="<?php echo $row['hisLink']; ?>"><?php echo $row['historyLinkText']; ?></a>
     } //end for
    }// endif

    Any help much appreciated

Viewing 1 replies (of 1 total)
  • I have found a solution.

    I am using:

    <h2 class="history">Historic shows</h2>
       <ul class="history">
         <?php if(get_field('history', $post->post_parent))
          { ?>
    	<?php while(has_sub_field('history', $post->post_parent)): ?>
               <a href="<?php the_sub_field('hisLink'); ?>"><?php the_sub_field('historyLinkText'); ?></a>
    	<?php endwhile;
    	    else {
    		echo 'Coming soon';
    		} ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Getting values from parent page’ is closed to new replies.