Support

Account

Home Forums Front-end Issues Get related Post Group repeater value

Unread

Get related Post Group repeater value

  • Hi all – I have a custom post type called case-studies that has several different field groups. In the template for this post type, I need to display a list of other posts of the same type. To do this I’m using a field group called ‘Case Study Cards’ that has a repeater named case_studies with one sub-field named case_study of a type Post Object. I can currently only display things like the post title:

    
    while (have_rows('case_studies')): the_row();
        // Get the <code>case_study</code> post object
        $caseStudy = get_sub_field('case_study');
        $relatedTitle = $caseStudy->post_title;
        ?>
        <?php echo $relatedTitle ?>
    <?php endwhile; ?>
    

    More specifically, one of the field groups named ‘Carousel’ has a repeater named ‘slides’ to store slides for a carousel, and I need to get the image from the first slide and display that in the above mentioned list as a thumbnail. I don’t know how to drill down into this array.

    To be honest I’m not even sure if Post Object is the right type to use as when I dump it out to the page I don’t see any of the custom field groups, so maybe this is the wrong approach. I’ve been developing for a long time but new to WordPress and ACF so I wouldn’t be surprised if I have this wrong.

    Thanks,
    Chris

Viewing 1 post (of 1 total)

The topic ‘Get related Post Group repeater value’ is closed to new replies.