Support

Account

Home Forums Backend Issues (wp-admin) One section on multiple sub-pages Reply To: One section on multiple sub-pages

  • Getting the values from another post or page would be difficult, you’d need to know ahead of time what post you want the get the values from, using an options page would be easier.

    In either case you would use an acf/load_field filter http://www.advancedcustomfields.com/resources/acfload_field/

    
    add_filter('acf/load_field/name=repeater_name', 'populate_repeater');
    function populate_repeater($field) {
      // I'm using an options page in this example
      // but you can change $other_post_id to something else
      $other_post_id = 'options';
      if (have_rows('repeater_name', $other_post_id)) {
        $value = array();
        $subfields = array(
          'list',
          'yours',
          'subfields',
          'here'
        );
        while (have_rows('repeater_name', $other_post_id)) {
          the_row();
          $row = array();
          foreach ($subfields as $subfield) {
            $row[$subfield] = get_sub_field($subfield);
          } // end foreach subfield
          $value[] = $row;
        } // end while have rows
        $field['value'] = $value;
      } // end if have rows
      return $field; 
    }