Support

Account

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.