Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Gibbs

    (@mgibbs189)

    Loops are simply PHP arrays. If you have a loop field called “gallery” with sub-fields “caption” and “image”, then…

    [ Moderator note: try to use backticks instead of pre for code. ]

    $loop_field = $cfs->get('gallery');
    foreach ($loop_field as $row) {
        // show image and caption ONLY if the image exists
        if (!empty($row['image'])) {
            echo ' IMAGE: ' . $row['image'];
            echo ' CAPTION: ' . $row['caption'];
        }
    }

    That should give you plenty to work with.

    Cheers,
    Matt

    Thread Starter lagunas

    (@lagunas)

    Great!
    I thought I tried that. Maybe I was missing something.

    Works perfectly, thank you!
    And thanks again for the great plugin!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional inside repeatable (loop)’ is closed to new replies.