Home › Forums › Add-ons › Repeater Field › Using repeater for look up not working › Reply To: Using repeater for look up not working
You are almost there, if you’re going to loop through the same repeater again then you should probable reset the rows as well. Or you may be able to break out of the loop if you reset the rows. You could try something like this.
function get_column_content($columnId){
if (have_rows("adv_columns",get_the_ID())){
while(have_rows("adv_columns",get_the_ID())){
the_row();
if(get_sub_field('column_id')==$columnId){
$found= get_sub_field('content');
break; // found it, don't continue looking
}
}
reset_rows();
} // end if have rows
return $found;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.