Support

Account

Home Forums General Issues Post object in a repeater in a group

Solved

Post object in a repeater in a group

  • Hi,

    I’ve set up a Group called ‘testimonials’ and inside that is a repeater called ‘testimonial_repeat’ which then allows the user to select a post object called ‘testimonial_object’

    I’ve tried everything I can think of to get it to show the title, content but cannot work out why.

    I can get a post object to appear in a group but not in a repeater as well.

    Anyone got ideas, please?

  • 
    // loop over group field
    if (have_rows('testimonials')) {
      // always true
      while (have_rows('testimonials')) {
        // always happens once
        the_row();
        // loop over the repeater
        if (have_rows('testimonial_repeat')) {
          while (have_rows('testimonial_repeat')) {
            the_row();
            // get repeater sub field
            $post_object = get_sub_field('testimonial_object');
          } // end while repeater has rows
        } // end if repeater has rows
      } // end while group field has rows
    } // end if group field has rows
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.