Support

Account

Home Forums Add-ons Repeater Field Repeater field with checkbox

Unread

Repeater field with checkbox

  • Hi there, wondering if the bright minds out there can help me with a little bit of PHP!

    I am trying to use the repeater field with the checkbox – so very close but not quite working how I need it.

    Basically, I have a field for deals, and then a checkbox to display which day the deal is on. If the checkbox is checked, I would like to display the deal. Right now it shows all the deals regardless of the checkbox.

    Any help would be greatly appreciated as PHP is not my strong suit (but this is probably super easy for someone else) 🙂

    Thank you! Here’s my code so far:

    <?php if( have_rows(‘bites’) ): ?>
    <?php while( have_rows(‘bites’) ): the_row(); ?>

    <?php
    // vars
    $day = get_sub_field_object(‘day_available’);
    $deal = get_sub_field(‘deal_description’);
    ?>
    <?php if ( $day && in_array(“monday”, $day)) {
    echo $deal;
    }

    endwhile;

    else :

    // no rows found

    endif; ?>

Viewing 1 post (of 1 total)

The topic ‘Repeater field with checkbox’ is closed to new replies.