Home Forums ACF PRO showing field from repeater from one page on another via dynamic select field


showing field from repeater from one page on another via dynamic select field

  • Hi all.

    Hoping someone can help me get my head around if this is possible.

    I have a repeater on one page (members) called panel_member and with a function from ACF, this is populating a select field on a blog post where I can select the panel member, which is all working fine.

    I also have another sub field in the panel_member repeater that is an image of the member. I’d like to show this image next in the blog template, but can’t seem to pull the info in.

    The idea is I can add panel members on the members page that I can then select within a post, then show the name and image for that row.

    This is my function…

    function acf_load_member_field_choices( $field ) {
        $field['choices'] = array();
        if( have_rows('panel_member', 15) ) {
            while( have_rows('panel_member', 15) ) {
                // vars
                $value = get_sub_field('name');
                $label = get_sub_field('name');
                // append to choices
                $field['choices'][ $value ] = $label;
        return $field;
    add_filter('acf/load_field/name=choose_member', 'acf_load_member_field_choices');

    The above code dynamically populates the “choose member” select field on the blog post without issue, I just can’t seem to figure out how to grab the headshot image from the row.

    I hope that makes sense and someone is able to help.


  • I do not see you trying to fetch the image anywhere. If it is a subfield of the repeater, you should be able to use get_sub_field('the_image_field_name');.
    Here you are fetching the name twice:

    $value = get_sub_field('name');
    $label = get_sub_field('name');

    Is that intentional?

  • Hi Daniel.

    That was code I found on ACF for generating a dynamic select field from repeater values.

    I’ve solved it thanks, on the post template I have a repeater field to check rows that then checks if the label == the same as the name sub field, and if so, shows the additional sub fields.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.