Home › Forums › Add-ons › Repeater Field › Loop Repeater Based on Sub Field Values › Reply To: Loop Repeater Based on Sub Field Values
Hi @tomwgf
That’s weird. Could you please try to remove the $content = null so it looks like this?
// PackageList shortcode
function treatmentlistf($atts) {
$returned = "";
if(have_rows('package_name', 'option')):
while(have_rows('package_name', 'option')): the_row();
if(get_sub_field('package_group') == 'caci_facials'):
$returned .= "<h2>Test Hello</h2>";
endif;
endwhile;
endif;
return $returned;
}
add_shortcode('treatmentlist', 'treatmentlistf');
The “option”s are used if you put the field group on an options page. If you put it on a post/page, I believe you don’t need it. You can also try to set a value for the $returned variable so it looks like this:
$returned = "the value";
If it the shortcode only returns “the value”, it means there is something wrong with the field.
I hope this makes sense.
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.