advanced custom fields – ACF repeater + group shortcode


I’ve wrote a few line in order to show a restaurant menu in a page using a shortcode

add_shortcode ('pescato_repeater', 'pescato_repeater_fn');
  function pescato_repeater_fn() {
    if( have_rows('pescato') ) {
    $content="<h2>Pescato del Mediterraneo<br><span id="eng">Caught of the Mediterranean</span></h2><table>";
      while( have_rows('pescato') ) { 
        $nome = get_sub_field('name');
        $content .= '<tr><td>' . implode("<br><span id=\"eng\">", $name) . '</span></td><td class="price">' .  get_sub_field('price') . ' €/Kg</td><tr>';
    $content .= '</table>';
    return $content;

the sub field name is a group in which there are names in italian and english, so I’m using implode in order to show the array.

elementor preview

The elementor preview is showing it correctly, but the page doesn’t. It has worked for a while but now, if I try to refresh the page, the loading seems to be locked in a loop that never ends

Any suggestions?
Thanks in advance 🙂

Enrico 2 years 2022-08-05T11:03:48-05:00 0 Answers 0 views 0

Leave an answer