Code Snippet – Elemento singolo: Prodotto

<?php
echo '<div class="ar-repeater">';
echo '<div class="ar-repeater__inner">';

if (have_rows('finitura_7_rep')) :
    while (have_rows('finitura_7_rep')) : the_row();
        $titolo_finitura = get_sub_field('titolo_finitura_7_rep');

        if (!empty($titolo_finitura)) {
            echo '<div class="ar-repeater__section">';
            echo '<h3 class="ar-repeater-title">' . esc_html($titolo_finitura) . '</h3>';
        }

        if (have_rows('tipi_finiture_7_rep')) :
            while (have_rows('tipi_finiture_7_rep')) : the_row();
                $titolo_gruppo = get_sub_field('titolo_gruppo_finiture_7_rep');

                if (!empty($titolo_gruppo)) {
                    echo '<div class="ar-repeater__group">';
                    echo '<h4 class="ar-repeater-subtitle">' . esc_html($titolo_gruppo) . '</h4>';
                }

                if (have_rows('immagini_titolo_finitura_7_rep')) :
                    echo '<div class="ar-repeater__images">';
                    echo '<ul>';

                    while (have_rows('immagini_titolo_finitura_7_rep')) : the_row();
                        $immagine = get_sub_field('immagine_dettaglio_finitura_7_rep');
                        $titolo_dettaglio = get_sub_field('titolo_dettaglio_immagine_finitura_7_rep');

                        echo '<li class="ar-repeater__item">';
                        echo '<div class="ar-repeater__content">';

                        if (!empty($immagine) && isset($immagine['url'])) {
                            echo '<img src="' . esc_url($immagine['url']) . '" alt="' . esc_attr($immagine['alt'] ?? '') . '" class="ar-repeater__img"/>';
                        }

                        if (!empty($titolo_dettaglio) && strpos($titolo_dettaglio, '{') === false) {
                            echo '<h5 class="ar-repeater__title-card">' . esc_html($titolo_dettaglio) . '</h5>';
                        }

                        echo '</div>';
                        echo '</li>';
                    endwhile;

                    echo '</ul>';
                    echo '</div>';
                endif;

                if (!empty($titolo_gruppo)) {
                    echo '</div>'; // chiude .ar-repeater__group
                }

            endwhile;
        endif;

        if (!empty($titolo_finitura)) {
            echo '</div>'; // chiude .ar-repeater__section
        }

    endwhile;
endif;

echo '</div>';
echo '</div>';
?>