Home › Forums › Add-ons › Repeater Field › Loop Repeater Based on Sub Field Values › Reply To: Loop Repeater Based on Sub Field Values
Hi @tomwgf
You need to return the shortcode instead of printing it like that. It should be something like this:
// PackageList shortcode
function treatmentlistf($atts, $content = null) { ?>
<?php
if(have_rows('package_name', 'option')):
while(have_rows('package_name', 'option')): the_row();
if(get_sub_field('package_group') == 'caci_facials'): ?>
return '<h2> Test hello</h2>'
<?php endif;
endwhile;
endif;
?>
<?php }
add_shortcode('treatmentlist', 'treatmentlistf');
This page should give you more idea about it: https://codex.wordpress.org/Function_Reference/add_shortcode.
Hope this helps.
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.